Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / March 2008



Tip: Looking for answers? Try searching our database.

Setting size for a parameter for a varchar(max) field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BobRoyAce - 21 Mar 2008 04:14 GMT
I am writing an application using VS2008 and SQL Server 2005. I have
code that executes a stored procedure for a table that has a field
which is varchar(max). I usually use code as follows to create and
populate a parameter...

 SQLParam(8) = New System.Data.SqlClient.SqlParameter
 With SQLParam(8)
   .ParameterName = "@LastProcessingResults"
   .DbType = DbType.String
   .Direction = ParameterDirection.Input
   .Size = 1000
   .Value = _LastProcessingResults
 End With

However, obviously, in this case, I don't want to set .Size = 1000.
What do I set .Size equal to for a varchar(max) field? Or, do I leave
out the .Size property altogether?
BobRoyAce - 21 Mar 2008 04:24 GMT
> However, obviously, in this case, I don't want to set .Size = 1000.
> What do I set .Size equal to for a varchar(max) field? Or, do I leave
> out the .Size property altogether?

I tried not setting the .Size property at all (believe it defaults to
ZERO) and that seems to work. Is this the correct way to implement it?
Ralph - 21 Mar 2008 15:25 GMT
> I am writing an application using VS2008 and SQL Server 2005. ...

This is the wrong newsgroup. This group is populated by programmers using
classic VB (VB6 or lower) and classic ADO (not ADO.NET).

You will be better served in a dotNet group (they all have "dotNet" in the
title), since there will be more programmers monitoring those groups that
use VB.Net, and any answers you get will also receive better scrutiny.

-ralph
BobRoyAce - 21 Mar 2008 16:36 GMT
> You will be better served in a dotNet group (they all have "dotNet" in the
> title), since there will be more programmers monitoring those groups that
> use VB.Net, and any answers you get will also receive better scrutiny.

Oops...thanks for the heads-up! :)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.