We help IT Professionals succeed at work.

DATAADAPTER EDIT SQL QUERY COMMAND IN CODE

rockas1982
rockas1982 used Ask the Experts™
on
I have a dataadapter and a dataset i fill the datagridview like this

DBdainvoices.Fill(DBdataset.invoices)

I want to change the select command (IN CODE) of the dataadapter so i can add an "WHERE orderid = 5"

something like this (dosent work because is read only)
DBdainvoices.Adapter.SelectCommand.CommandText = "SELECT idinvoice, idorder, seira, aa, code, descr, page, price, quantity, sumprice FROM invoices WHERE idorder = " & ggGrid.Item(e.RowIndex, 0).Value

Thnx
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Right click TableAdapter
Choose Add Query
Choose Select That Returns Rows
In the command text write one of:

If you are Using MS Access
Select * From tblVehicles Where fldMake = ?

If you are Using SQ Server
Select * From tblVehicles Where fldMake = @make

If you are Using Oracle
Select * From tblVehicles Where fldMake = :make

Call the methods FillByMake/GetDataByMake


now in your code, do:

vehiclesTableAdapter.FillByMake(vehiclesDataSet.Ve hiclesDataTable, "Ford")