Where to look up ADODB.Parameters Size arg values?

mdlueck

Sr. Application Developer
Local time
Today, 01:46
Joined
Jun 23, 2011
Messages
2,648
Great news! Yesterday I finally was able to make work a SQL INSERT statement to an Access FE temp table using an ADODB.Command object and using ADODB.Parameters objects to pass in the args to INSERT. Woo hoo!! :D

The fourth arg to the CreateParameter call is a Size arg. I see various sites listing the allowable Type values. I can not find the Size suggestions for non variable size Types... like adBoolean as example... that has to be a specific size, but what is the correct number?!!?!?

So, I am thinking to share as an example in the Code Repository group as even in the Access 2007 Bible pub by Wiley Publishing there is no ADODB.Command example of an INSERT / UPDATE statement using ADODB.Parameters objects to pass in the values, rather all places lean towards using an ADODB.Recordset for that sort of operation.
 
I found what I was looking for here:

"Data Type Mapping"
http://www.carlprothman.net/Default.aspx?tabid=97

This table has the illusive Size column of information critical to creating ADODB.Parameters objects. "Bookmarked!" ;)

Thanks DJkarl, I had seen that page. It does not give the size of each data type, just says that such is required, otherwise an error occurs. Yes, I can see that! Now what to do about it!? :confused:
 
Ahh, well you could also use the Len function on whatever your value type is.

So if you needed a long you could use Len(Clng("YourLongValue")) and it would give you the size of 4.
 
Ahh, well you could also use the Len function on whatever your value type is.

So if you needed a long you could use Len(Clng("YourLongValue")) and it would give you the size of 4.

Since the size is "rather fixed" I prefer to hard code the correct number.

I posted to the "Core Repository" forum my suggestion and it is awaiting moderation... so I can not link to it from here now.
 

Users who are viewing this thread

Back
Top Bottom