How can configure parameter when OledbDataadapter was created with wizard

  • Thread starter Thread starter Herman P via DotNetMonster.com
  • Start date Start date
H

Herman P via DotNetMonster.com

Dear friends;

I am trying to cofigure Oledbdatadabter with wizard. And i am using ACCESS
database.I want to use parameter in OledbDataadapter Select Command Property
window.
I have simple form which has a one combobox, one datagrid and one update
button. I want make select like this Select * from Banks where BankName=
combobox.text but if i write Select * from Banks where BankName='CITIBANK'
query is working. But i can not take parameters from combobox.
In OledbDataadapter Select Command Property window i see Parameters Property
but i can not configure it.

If u can please help me about my trouble.

Thanks a lot
 
Hi,

Herman P via DotNetMonster.com said:
Dear friends;

I am trying to cofigure Oledbdatadabter with wizard. And i am using ACCESS
database.I want to use parameter in OledbDataadapter Select Command
Property
window.
I have simple form which has a one combobox, one datagrid and one update
button. I want make select like this Select * from Banks where BankName=
combobox.text but if i write Select * from Banks where BankName='CITIBANK'

Configure the OleDbDataAdapter with a query like "SELECT * FROM Banks WHERE
BankName = ?". Then before you fill the DataSet or DataTable you can set
the parameter value to your combobox.text :

OleDbDataAdapter1.SelectCommand.Parameters("BankName").Value = ComboBox.Text
OleDbDataAdapter1.Fill ( ... )

You will probely want to call this code from a ComboBox.SelectedIndexChanged
eventhandler.

HTH,
Greetings
 
Try using either:
combobox.SelectedText
OR
combobox.SelectedValue

To get the parameter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top