Home All Groups Group Topic Archive Search About

Passing parameters to Data Adapter

Author
15 Apr 2005 6:10 PM
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_name").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

Author
15 Apr 2005 6:21 PM
Marcie Jones
You can have multiple lines there:
SqlDataAdapter1.SelectCommand.Parameters("@last_name").Value =
TextBox1.Text
SqlDataAdapter1.SelectCommand.Parameters("@first_name").Value =
TextBox2.Text

Marcie

On Fri, 15 Apr 2005 11:10:03 -0700, "TS"
<T*@discussions.microsoft.com> wrote:

Show quoteHide quote
>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_name").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
Author
15 Apr 2005 6:52 PM
TS
Thanks a lot, it worked.

Show quoteHide quote
"Marcie Jones" wrote:

> You can have multiple lines there:
> SqlDataAdapter1.SelectCommand.Parameters("@last_name").Value =
> TextBox1.Text
> SqlDataAdapter1.SelectCommand.Parameters("@first_name").Value =
> TextBox2.Text
>
> Marcie
>
> On Fri, 15 Apr 2005 11:10:03 -0700, "TS"
> <T*@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_name").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
>
>
Author
15 Apr 2005 6:27 PM
Chris
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_name").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