dovobet
December 5th, 2009, 04:12 PM
hi
Im trying to read data from a database on an SQL Server ( not compact) but I keep having the problem with the code
SqlCommand readAccounts = new SqlCommand
("SELECT * from sahebfp9_Accounts", connectionLine);
reader = readAccounts.ExecuteReader();
string tempUsername = reader.GetString(1).Trim();
The bottom line throws a InvalidOperationException and says {"Invalid attempt to read when no data is present."} but I do have data in the database table.
Can somebody help?
Im trying to read data from a database on an SQL Server ( not compact) but I keep having the problem with the code
SqlCommand readAccounts = new SqlCommand
("SELECT * from sahebfp9_Accounts", connectionLine);
reader = readAccounts.ExecuteReader();
string tempUsername = reader.GetString(1).Trim();
The bottom line throws a InvalidOperationException and says {"Invalid attempt to read when no data is present."} but I do have data in the database table.
Can somebody help?