473,320 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to read data using two parameters?

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.
Nov 15 '05 #1
1 1351
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"ST Choong" <st******@srm.com.my> wrote in message
news:ea**************@TK2MSFTNGP09.phx.gbl...
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.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Doug | last post by:
Working on converting an Access front-end/SQL Server back-end to a .NET front/SQL Server back-end. We are also redesiging the SQL Server database. We have many Word/Excel documents that have...
0
by: Jerry | last post by:
Below is ALL the code for all the databases... Here's the problem: I callup the aspx file in IE and the form comes up just fine. When I select a person to update, I get the subject error. ...
5
by: Gene | last post by:
What can I do if I want to get the result using the sql command? for example, the select command is "select Name from Employee where StaffID=10" How to get the "Name"??? dim Name as string and...
5
by: DC Gringo | last post by:
I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to...
9
by: fniles | last post by:
When using VB6 and ADO, if I only do a Read, I will open a recordset with Forward Only cursor and Read Only lock, thus it will be faster than a non Read recordset. In VB.NET, when only need to do...
3
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I try to follow Steve's paper to build a database, and store a small text file into SQL Server database and retrieve it later. Only difference between my table and Steve's table is that I use NTEXT...
2
by: adypoly | last post by:
Hi guys... I am having a typical problem in using one of the native dll in C# I'll explain what am trying to do, I've a dll written in C language which i am trying to include in my C# project,...
5
by: Sanjay Pais | last post by:
I have a table with over 1.3 million rows. I am retrieving only 20 at a time using the with - over clauses In query analyser, the data is retrieved in under a second. When retrieving using the...
2
by: Jared Grant | last post by:
I am trying to find the value from some output parameters from a stored procedure. I have tried several different methods but somehow cannot get it to work. here is my source code: dim dr as...
6
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.