|
-
December 5th, 2009, 05:12 PM
#1
Reading from a SQL Server Database
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|