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)
...
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)