469,648 Members | 1,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

OleDbParameter Query: Multiple parameters

Hello,

I am calling a SQL Server 2K parameter query with the following:

Dim spWebDocGroup As OleDb.OleDbDataReader
Dim prmWebDocGroup As OleDbParameter
Dim cmdWebDocGroup As New OleDb.OleDbCommand("zsp_web_WebDocument",
cnnSearch)
cmdWebDocGroup.CommandType = CommandType.StoredProcedure
prmWebDocGroup = cmdWebDocGroup.Parameters.Add("@strParm00",
OleDbType.VarChar, 30)
prmWebDocGroup.Value = "FindDocList"

How do you add multiple parameters (@strParm01, @strParm02 ect.) and their
respective values?

--
Thanks in advance,

Steven
Nov 18 '05 #1
1 3164
One other tip:
OLEDB named parameters don't work the way that SQL named parameters do.
The sequence that you create the OLEDB param is what is used! Not the name.
So build them in the sequence you plan to use them!
I lost an hour to that little nuance!
--
Joe Fallon
"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
How do you add multiple parameters (@strParm01, @strParm02 ect.) and
their respective values?
Almost the same way you are doing now.

prmWebDocGroup = cmdWebDocGroup.Parameters.Add("@strParm00", OleDbType.VarChar, 30) prmWebDocGroup.Value = "FindDocList"

Instead try the following,

cmdWebDocGroup.Parameters.Add(New OleDbParameter("@strParm00", OleDbType.VarChar, 30)) cmdWebDocGroup.Parameters("@strParm00").Value = "FindDocList"
cmdWebDocGroup.Parameters.Add(New OleDbParameter("@strParm01", OleDbType.Integer)) cmdWebDocGroup.Parameters("@strParm01").Value = "FindDocList1"
cmdWebDocGroup.Parameters.Add(New OleDbParameter("@strParm02", OleDbType.Date)) cmdWebDocGroup.Parameters("@strParm02").Value = "FindDocList2"
cmdWebDocGroup.Parameters.Add(New OleDbParameter("@strParm03", OleDbType.VarChar, 30)) cmdWebDocGroup.Parameters("@strParm03").Value = "FindDocList3"
.....

Suresh.

----- Steven K wrote: -----

Hello,

I am calling a SQL Server 2K parameter query with the following:

Dim spWebDocGroup As OleDb.OleDbDataReader
Dim prmWebDocGroup As OleDbParameter
Dim cmdWebDocGroup As New OleDb.OleDbCommand("zsp_web_WebDocument",
cnnSearch)
cmdWebDocGroup.CommandType = CommandType.StoredProcedure
prmWebDocGroup = cmdWebDocGroup.Parameters.Add("@strParm00",
OleDbType.VarChar, 30)
prmWebDocGroup.Value = "FindDocList"

How do you add multiple parameters (@strParm01, @strParm02 ect.) and their respective values?

--
Thanks in advance,

Steven

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by TattyMane bigpond.net.au> | last post: by
1 post views Thread by Marco Martin | last post: by
3 posts views Thread by bby | last post: by
3 posts views Thread by Agnes | last post: by
1 post views Thread by Agnes | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.