append parameter - data types in adp that correspond to sql data types

K

Keith G Hicks

Is there a chart somewhere that shows the related datatypes to use in the
code to create stored procedure parameters in ms access like in the
following:

.Parameters.Append .CreateParameter("@sPropState", adVarChar,
adParamInput, 2, Me.PropState)

as they compare to the data types in ms sql 2k?

For example, I have a "text" data type in my stored procedure as an input
parameter but there is no "adText" data type in vba. I'm not sure what to
use.

Thanks,

Keith
 
S

Sylvain Lafontaine

The file adovbs.inc (there is also a version for javascript) that you will
find on your machine contains them all but here's a transcript:
http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=122

You can also use a typelib instead:
http://www.asp101.com/articles/john/typelibs/default.asp

Don't forget that the name of the parameters is not important but that their
order is. Also, as you have a return value, you must add a parameter of
type adParamReturnValue and it must be the first of the list. Finally, you
can use a simple routine to retrieve the desired values:

Dim p As ADODB.Parameter
cmd.Parameters.Refresh

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
 

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