error in the code

Asked By Dvorkin
05-Sep-10 01:36 PM
Earn up to 0 extra points for answering this tough question.

i write the following code and adding data in the text box through combo box which is linked with access database but it is giving error .... the error is (Object is not an ADODB.RecordSet or an ADODB.Record.Parameter name: adodb)
... can you tell me what is the error in the following code:

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)

{

OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Harpreet\\Documents\\access\\db2.mdb");

OleDbCommand cmdd = new OleDbCommand("Select * from Table1 where name ='" + comboBox1.SelectedValue + "'", con);

OleDbDataAdapter adpp = new OleDbDataAdapter(cmdd);

DataTable dtr = new DataTable();

adpp.Fill(dtr, "Table1");

if (dtr.Rows.Count > 0)

{

textBox1.Text = dtr.Rows[0]["Table1"].ToString();

}

}

  re: error in the code

Web Star replied to Dvorkin
05-Sep-10 02:49 PM
see this link , it has solution for that.
http://www.vbforums.com/archive/index.php/t-425414.html
Create New Account