How to read data using two parameters?

  • Thread starter Thread starter ST Choong
  • Start date Start date
S

ST Choong

this.oleDbCommand1.CommandText = "SELECT Description, [Channel Number], Bit
FROM IO WHERE (Type = \'@Type\' AND Module = \'@Module\')";

this.oleDbCommand1.Connection = this.oleDbConnection1;

this.oleDbCommand1.Parameters.Add("@Type",
System.Data.OleDb.OleDbType.WChar, 50, e.Node.Parent.Text);

this.oleDbCommand1.Parameters.Add("@Module",
System.Data.OleDb.OleDbType.WChar, 50, e.Node.Text);

this.oleDbCommand1.Connection.Open();

System.Data.OleDb.OleDbDataReader myReader =
this.oleDbCommand1.ExecuteReader();

myReader.Close();

this.oleDbCommand1.Connection.Close();



I get error while executereader. Please help me.

Thanks.
 
Hi,

What is the error you are getting? maybe the values of the parameters are
not the correct one. insert all the code in a try/catch block and see what
the exception Message says.

Cheers,
 

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