Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with OleDbDatareader

Status
Not open for further replies.

guttaboys

Programmer
Oct 28, 2003
17
NO
I have a small application wich connects to a Access database. I run a query to the database to fetch one record from one table an put it in a OleDbDatareader.

...
con = new OleDbConnection();
con.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"+
"User ID=Admin;Password=;" +
"Data source=E:\\Databaser\\Olje.mdb";

String sql = "SELECT * FROM Kunde";
try
{
con.Open();
cmd = new OleDbCommand(sql,con);
reader = cmd.ExecuteReader();

if(reader.Read())
....

What I can't understand is, when I debug this code (line by line) I will get no records in the datareader. If I run the code without any debugging I get the one row I want. Anyone who knows about this? I'm realy a Java man and are getting realy frustrating about the databaseconnection eith the C#.net (maby I overlook something)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top