Skip to content Skip to sidebar Skip to footer

Adodb Connection To Upload Data To Sql Using Bind Variables

I'm trying to upload some data into a SQL database from a spreadsheet. I'm Using the code from here as a base, had to make a few mods in order to get it to work. Sub newtest() Dim

Solution 1:

In my opinion you mix notation for stored procedure and text type of command but...

  1. you can omit @ when passing parameters
  2. you should add cmd.CommandType = adCmdText right after your cmdCommandText line
  3. I would change SQL query into:

"insert into EcommerceXRefMapping_C_Copy values (?, ?, ?, ?)"

and next pass parameters in this way (where correct order is important):

cmd.Parameters(0) = c1
cmd.Parameters(1) = c2
cmd.Parameters(2) = c3
cmd.Parameters(3) = c4

Post a Comment for "Adodb Connection To Upload Data To Sql Using Bind Variables"