PC Review


Reply
Thread Tools Rate Thread

adLongVarChar parameter for TEXT data type size problem

 
 
Keith G Hicks
Guest
Posts: n/a
 
      8th Oct 2008
I'm trying to run a sql stored procedure where one of the parameters is TEXT
datatype. Through some online research I found that the 2nd parameter in the
line below needs to be adLongVarChar to accomodate the backend's TEXT
datatype. But I have no idea what to put in the "size" parameter position.
I've tried a few kind of at random but get errors on the execute statement
that it's wrong. If I leave it blank it tells me it's not properly defined.

..Parameters.Append .CreateParameter("@FullNoticeText", adLongVarChar,
adParamInput, <WHAT GOES HERE?>, Trim(Me.FullNoticeText))

Can anyone tell me what value I need to use there?

Thanks,

Keith


 
Reply With Quote
 
 
 
 
Sylvain Lafontaine
Guest
Posts: n/a
 
      8th Oct 2008
Here's a little procedure to display the parameters and their properties for
a SP:

Sub ListOfParameters (ProcedureName As String)

Dim cmd As ADODB.Command
Set cmd = New ADODB.Command

Set cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = ProcedureName

cmd.Parameters.Refresh

Dim p As ADODB.Parameter

For Each p In cmd.Parameters
Debug.Print "name = " & p.name
Debug.Print "Direction = " & p.Direction
Debug.Print "Type = " & p.Type
Debug.Print "Size = " & p.Size
Debug.Print "Precision = " & p.Precision
Debug.Print "NumericScale = " & p.NumericScale
Debug.Print
Next

Set cmd = Nothing

End Sub

For using this procedure, you must *not* give the prefix dbo. to the name of
the SP. See http://www.asp101.com/articles/john/adovbs/adojavas.inc for the
numerical values.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


"Keith G Hicks" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I'm trying to run a sql stored procedure where one of the parameters is
> TEXT
> datatype. Through some online research I found that the 2nd parameter in
> the
> line below needs to be adLongVarChar to accomodate the backend's TEXT
> datatype. But I have no idea what to put in the "size" parameter position.
> I've tried a few kind of at random but get errors on the execute statement
> that it's wrong. If I leave it blank it tells me it's not properly
> defined.
>
> .Parameters.Append .CreateParameter("@FullNoticeText", adLongVarChar,
> adParamInput, <WHAT GOES HERE?>, Trim(Me.FullNoticeText))
>
> Can anyone tell me what value I need to use there?
>
> Thanks,
>
> Keith
>
>



 
Reply With Quote
 
Keith G Hicks
Guest
Posts: n/a
 
      8th Oct 2008
Thank you.

"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:(E-Mail Removed)...
> Here's a little procedure to display the parameters and their properties

for
> a SP:
>
> Sub ListOfParameters (ProcedureName As String)
>
> Dim cmd As ADODB.Command
> Set cmd = New ADODB.Command
>
> Set cmd.ActiveConnection = CurrentProject.Connection
> cmd.CommandType = adCmdStoredProc
> cmd.CommandText = ProcedureName
>
> cmd.Parameters.Refresh
>
> Dim p As ADODB.Parameter
>
> For Each p In cmd.Parameters
> Debug.Print "name = " & p.name
> Debug.Print "Direction = " & p.Direction
> Debug.Print "Type = " & p.Type
> Debug.Print "Size = " & p.Size
> Debug.Print "Precision = " & p.Precision
> Debug.Print "NumericScale = " & p.NumericScale
> Debug.Print
> Next
>
> Set cmd = Nothing
>
> End Sub
>
> For using this procedure, you must *not* give the prefix dbo. to the name

of
> the SP. See http://www.asp101.com/articles/john/adovbs/adojavas.inc for

the
> numerical values.
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: sylvain aei ca (fill the blanks, no spam please)
>
>
> "Keith G Hicks" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > I'm trying to run a sql stored procedure where one of the parameters is
> > TEXT
> > datatype. Through some online research I found that the 2nd parameter in
> > the
> > line below needs to be adLongVarChar to accomodate the backend's TEXT
> > datatype. But I have no idea what to put in the "size" parameter

position.
> > I've tried a few kind of at random but get errors on the execute

statement
> > that it's wrong. If I leave it blank it tells me it's not properly
> > defined.
> >
> > .Parameters.Append .CreateParameter("@FullNoticeText", adLongVarChar,
> > adParamInput, <WHAT GOES HERE?>, Trim(Me.FullNoticeText))
> >
> > Can anyone tell me what value I need to use there?
> >
> > Thanks,
> >
> > Keith
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter Type/Size Property Values for VARCHAR(MAX) Stored Proc Parameter jcpc Microsoft ASP .NET 2 26th Jan 2011 11:48 AM
Re: Parameter size for NVARCHAR(MAX) data type? Bragi Of Erin Microsoft ADO .NET 0 22nd Oct 2010 07:12 PM
Parameter size for NVARCHAR(MAX) data type? pedestrian via DotNetMonster.com Microsoft ADO .NET 1 2nd Oct 2007 10:09 AM
Cell size? Or size limit for Text data type? =?Utf-8?B?Q0NsZW0=?= Microsoft Excel Misc 0 21st Apr 2006 04:09 PM
OracleCommadbuilder: Exception: Parameter 'p1': No size set for variable length data type: String. Peter Meinl Microsoft ADO .NET 6 17th Sep 2004 02:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:16 AM.