473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 3529
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: TattyMane bigpond.net.au> | last post by:
Hi I am trying to follow the walkthrough on MSDN http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkWalkthroughUpdatingDataUsingDatabaseUpdateQueryInWebForms.asp however, as I do not have...
1
by: Marco Martin | last post by:
Hi, I've got an oledb parameter that I'm sending to an Access DB. The table I'm sending it to has a column called "Zone" of type String that has a default value of "". So I create the...
3
by: bby | last post by:
what's wrong? string SQL="update D_User set Photo=@Photo where ID=@ID"; OleDbCommand myCommand=new OleDbCommand (SQL,connection); OleDbParameter myParm1 =new...
2
by: Sagaert Johan | last post by:
Hi I try to use this as sql string ( The field i compare with is variable. ) "SELECT * FROM FMatrix WHERE @wantedfield=@criteria" i use the Parameters.Add with OleDbType.WChar . Why can't...
3
by: Agnes | last post by:
Dim ocmdElem As New OleDbCommand() With ocmdElem .Parameters.Add(New OleDbParameter("@cocode", OleDbType.VarChar, 10, "TEST")) .CommandText = "select loginid from coinfo where code =@cocode "...
1
by: Agnes | last post by:
..Parameters.Add(New OleDbParameter("@cocode", OleDbType.VarChar, 10, UserName)) (A).CommandText = "select 'loginid' from 'coinfo' where 'loginid' = ? " (B).CommandText = "select loginid from...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
1
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
1
by: NIRAL12 | last post by:
public int ExecuteNonQuery(string query, params OleDbParameter parameters) { OleDbConnection cnn = new OleDbConnection(strConnectionString); OleDbCommand cmd = new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.