A DataAdapter still requires a Command object.  When you pass in the
SQL text into the constructor, it turns that into a command - your
parameters actually belong to the Command, not the DataAdapter.  You
can access the command through the "SelectCommand" property of your
DataAdapter, so you can do your parameters that way.

I haven't used DataSets in a while, but I believe that's all you need
to do.

On Jan 19, 2:07 am, Helvin <[email protected]> wrote:
> I used parametized statements with MySqlCommand fine. But then I want
> to bind my data to a dataset (so that it can be displayed as a
> dadtaGrid) instead of using a datareader. (am i
> using the right jargon?) however, parameters apparently is not a
> member of dataAdapters.( Compiler Error Message: BC30456: 'Parameter'
> is not a member of
> 'MySql.Data.MySqlClient.MySqlDataAdapter'.) What should I do??? I
> have
> commented out my tries with executeReader, but my dataAdapter
> produces
> the error I bracketed above.
>
>     'Using sqlComm_search As New MySqlCommand("SELECT part_no,
> cust_part_no, customer FROM table1 WHERE part_no LIKE '%...@part_no%'",
> myConnection)
>     'sqlComm_search.Parameters.AddWithValue("@part_no",
> search_part_no.Text)
>
>     'Using sqlRead As MySqlDataReader = sqlComm_search.ExecuteReader
> ()
>     Using myDA As New MySqlDataAdapter("SELECT part_no, cust_part_no,
> customer FROM table1 WHERE part_no LIKE '%...@part_no%'", myConnection)
>         myDA.Parameter.AddWithValue("@part_no", search_part_no.Text)
>         Using myDataSet As New Dataset()
>           myDA.Fill(myDataset, "part numbers")
>           MySQLDataGrid.DataSource = myDataSet
>           MySQLDataGrid.DataBind()
>         End Using
>      End Using
>
> Is there a way for me to display the data found from my database thats
> more convenient than using a datagrid? or how can i still implement
> parametized statements with dataSets?
>
> Thanks!
> Helvin

Reply via email to