Parameters in INSERT query problem
From: MJS (a_at_b.com)
Date: 03/21/05
- Next message: jk: "RE: Multiple primary keys with ADOX under C#"
- Previous message: Cacho: "Query problem"
- Next in thread: Daniel Crichton: "Re: Parameters in INSERT query problem"
- Reply: Daniel Crichton: "Re: Parameters in INSERT query problem"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 21 Mar 2005 15:27:22 -0600
I have a query that works.... but I want to clean it up, using ?'s for the
parameters in the query... but I am having a problem, I keep getting an
error: "Run-time error '3001': Arguments are of the wrong type, are out of
acceptable range, or are in conflict with one another.".
Like I stated... the query in this format works:
cmd.CommandText = "INSERT INTO MyTable(SomeString1, SomeInt,
SomeString2) VALUES('" & _
str1 & "'," & _
int1 & ",'" & _
str2 & "')"
But I want to simplify the CommandText string... and use queries like the
following... some of my queries will have many params.
cmd.CommandText = "INSERT INTO MyTable(SomeString1, SomeInt,
SomeString2) VALUES(?,?,?)"
Set rst = cmd.Execute(Parameters:=Array(str1, int1, str2))
I am able to do this successfully if I have only one ?, but when I have
multiple, it doesn't want to work.
Any Ideas?
- Next message: jk: "RE: Multiple primary keys with ADOX under C#"
- Previous message: Cacho: "Query problem"
- Next in thread: Daniel Crichton: "Re: Parameters in INSERT query problem"
- Reply: Daniel Crichton: "Re: Parameters in INSERT query problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|