473,387 Members | 1,844 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,387 software developers and data experts.

Passing parameters to Data Adapter

TS
Hi everyone,
I wrote the following code to pass a parameter value to the Data Adapter to
fill in the dataset based on the parameter's value.
SqlDataAdapter1.SelectCommand.Parameters("@last_na me").Value =
TextBox1.Text

It works fine, but now I need to specify two parameters (last name and first
name). How can I add the first name parameter in my code??

Thanks a million
--
TS
Nov 21 '05 #1
3 9037
You can have multiple lines there:
SqlDataAdapter1.SelectCommand.Parameters("@last_na me").Value =
TextBox1.Text
SqlDataAdapter1.SelectCommand.Parameters("@first_n ame").Value =
TextBox2.Text

Marcie

On Fri, 15 Apr 2005 11:10:03 -0700, "TS"
<TS@discussions.microsoft.com> wrote:
Hi everyone,
I wrote the following code to pass a parameter value to the Data Adapter to
fill in the dataset based on the parameter's value.
SqlDataAdapter1.SelectCommand.Parameters("@last_na me").Value =
TextBox1.Text

It works fine, but now I need to specify two parameters (last name and first
name). How can I add the first name parameter in my code??

Thanks a million


Nov 21 '05 #2
TS wrote:
Hi everyone,
I wrote the following code to pass a parameter value to the Data Adapter to
fill in the dataset based on the parameter's value.
SqlDataAdapter1.SelectCommand.Parameters("@last_na me").Value =
TextBox1.Text

It works fine, but now I need to specify two parameters (last name and first
name). How can I add the first name parameter in my code??

Thanks a million


SelectCommand.Parameters.Add(new
System.Data.OleDb.SQLDbParameter("Name",
System.Data.OleDb.OleDbType.Integer))

Chris
Nov 21 '05 #3
TS
Thanks a lot, it worked.

"Marcie Jones" wrote:
You can have multiple lines there:
SqlDataAdapter1.SelectCommand.Parameters("@last_na me").Value =
TextBox1.Text
SqlDataAdapter1.SelectCommand.Parameters("@first_n ame").Value =
TextBox2.Text

Marcie

On Fri, 15 Apr 2005 11:10:03 -0700, "TS"
<TS@discussions.microsoft.com> wrote:
Hi everyone,
I wrote the following code to pass a parameter value to the Data Adapter to
fill in the dataset based on the parameter's value.
SqlDataAdapter1.SelectCommand.Parameters("@last_na me").Value =
TextBox1.Text

It works fine, but now I need to specify two parameters (last name and first
name). How can I add the first name parameter in my code??

Thanks a million


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
1
by: Machelle Chandler | last post by:
All, I'm trying to populate a datagrid with a data adapter that uses a stored procedure with a parameter. I get the below error when I run my code (as seen below). Any hints? If I delete...
1
by: rocky20 | last post by:
I am new to .NET and I'm trying to move data from a local database to a remote database. The only way to access the remote database is through a web server. What I want to do is pull the records...
0
by: Luqman | last post by:
I have created a parameter for a field "CN" defined in Oracle as Varchar2(15), in typed dataset of VB.Net 2005. When I try to preview data, in dataset designer, by right click on Table Adapter...
0
by: Dennis | last post by:
I created a table adapter on an xsd that uses 4 basic stored procedures for select, update, insert, delete. Then I created an aspx page with an object data source that uses the table adapter and a...
2
by: The KID | last post by:
Hi All So I'm new to this. What I am trying to is the user will fill in a series of text boxes or drop downs. Lets say for this instance begin date and end date. Then they would click a button and...
2
by: zombiemasta | last post by:
Hi, I've wrote a stored procedure which expects a parameter to be passed in on the WHERE clause for channelID. The stored procedure runs fine in Navicat for MySQL when you specify the parameter...
2
by: DaveL | last post by:
Hello I want to build Dynamic Paramers for a Sql Insert below is what i have so far but...determinthe column type and length im having Problems with Tks dave string sInsert = "Insert into...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.