Data Type Sizes

G

Guest

I'm using VB.Net 2005 and am defining parameters for a stored procedure using
the following code snippet.

MyBase.sqlAddParameter("@strExtension", _
SqlDbType.NVarChar, 4, _
objEmployee.Tables("tblEmployees").Rows(0).Item("Extension"))

In this case I know the length of my variable as 4 charactes long. But, I
also have SQL Variable Types of Image and NText. NText has no defined size,
nore does Image as far as I can tell. What values am I to put in these cases.
Better, yet, where can I find the sizes for all the SQL Server Types for this
statement.

Thanks;.
 
W

WenYuan Wang [MSFT]

Hello AccessVBAnet,

According to your description, you want to know how to define the size of
SQLParameter when the underlying data type is Image/NText. If I
misunderstood anything here, please correct me.

My suggestion is you needn't to specify the size for Image parameter. If it
is not explicitly set in the size parameters, the Size and Precision are
inferred from the value of the dbType parameter

By the way, you can also set it as "0" if it is necessary in your case.
this._adapter.InsertCommand.Parameters.Add(new
global::System.Data.SqlClient.SqlParameter("@Image",
global::System.Data.SqlDbType.Image, 0,
global::System.Data.ParameterDirection.Input, 0, 0, "Image",
global::System.Data.DataRowVersion.Current, false, null, "", "", ""));"

Hope this helps. Please feel free to update here again, if you have any
more concern. We are glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

WenYuan Wang [MSFT]

Hello,

This is Wen Yuan again. I just want to check if there is anything we can
help with.
Please feel free to update here again, if you have any more concern. We are
glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top