Home All Groups Group Topic Archive Search About

How can I pass parameter to Typed Dataset in VB.Net 2005?

Author
20 Mar 2006 11:30 AM
Luqman
I have created a typed dataset and data adapter at design time in XSD File,
and created a parameter.

For example:

Select * from customers where CustomerID=@custid

Now how can I pass the parameter "ALFKI" at runtime.

I searched the internet which says,

myAdapter.SelectCommand.Parameters("@custid").value="ALFKI"

but there is no SelectCommand shows after myAdapter. ?

What am I missing ?

I am using VB.Net 2005.

Author
20 Mar 2006 11:47 AM
Luqman
I forgot to inform that I am using Microsoft Access Northwind Database 2000.

Show quoteHide quote
"Luqman" <pearls***@cyber.net.pk> wrote in message
news:e7Q6EFBTGHA.776@TK2MSFTNGP09.phx.gbl...
> I have created a typed dataset and data adapter at design time in XSD
File,
> and created a parameter.
>
> For example:
>
> Select * from customers where CustomerID=@custid
>
> Now how can I pass the parameter "ALFKI" at runtime.
>
> I searched the internet which says,
>
> myAdapter.SelectCommand.Parameters("@custid").value="ALFKI"
>
> but there is no SelectCommand shows after myAdapter. ?
>
> What am I missing ?
>
> I am using VB.Net 2005.
>
>
>
Author
20 Mar 2006 12:07 PM
Larry Lard
Luqman wrote:
Show quoteHide quote
> I have created a typed dataset and data adapter at design time in XSD File,
> and created a parameter.
>
> For example:
>
> Select * from customers where CustomerID=@custid
>
> Now how can I pass the parameter "ALFKI" at runtime.
>
> I searched the internet which says,
>
> myAdapter.SelectCommand.Parameters("@custid").value="ALFKI"
>
> but there is no SelectCommand shows after myAdapter. ?
>
> What am I missing ?
>
> I am using VB.Net 2005.

In the visual Dataset Designer, right click the Customers tableadapter,
and choose Add | Query... and follow the wizard through, providing your
SQL statement where prompted. This will create methods named (by
default) FillBy and GetDataBy on the TableAdapter, which will take
arguments corresponding to the parameters in the SQL statement. There's
good examples in the documentation, I believe.

--
Larry Lard
Replies to group please
Author
20 Mar 2006 12:57 PM
Cor Ligthert [MVP]
Luqman,

Go to the solution explorere
Change in top the icon show all files to show all files.
Have than a look at your typed dataset in that and especially that with the
extention .vb
That is the Strongly Typed Dataset that the designer created

(In windowforms by the way)

I hope this helps,

Cor

Show quoteHide quote
"Luqman" <pearls***@cyber.net.pk> schreef in bericht
news:e7Q6EFBTGHA.776@TK2MSFTNGP09.phx.gbl...
>I have created a typed dataset and data adapter at design time in XSD File,
> and created a parameter.
>
> For example:
>
> Select * from customers where CustomerID=@custid
>
> Now how can I pass the parameter "ALFKI" at runtime.
>
> I searched the internet which says,
>
> myAdapter.SelectCommand.Parameters("@custid").value="ALFKI"
>
> but there is no SelectCommand shows after myAdapter. ?
>
> What am I missing ?
>
> I am using VB.Net 2005.
>
>
>