c# - An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll 430 -



c# - An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll 430 -

the da.fill(ds) giving me an unhandled exception of type 'system.invalidoperationexception' occurred in system.data.dll

i'm not 100% sure why error here know appeared after attempted login code.

using (sqlconnection con = new sqlconnection("data source=c:\\registrationmdb.accdb")) { sqldataadapter da = new sqldataadapter(); dataset ds = new dataset(); sqlcommand cmd = new sqlcommand("select id, password students id = @id or password = @password", con); cmd.commandtype = commandtype.storedprocedure; cmd.parameters.add("@id", sqldbtype.varchar).value = id; cmd.parameters.add("@password", sqldbtype.varchar).value = pw; da.fill(ds); foreach (datarow dr in ds.tables[0].rows) { id = (dr["@id"].tostring()); password = dr["@password"].tostring(); } if (id == id && password == pw) { homecoming true; } else { lognotification = "id/password incorrect"; homecoming false; } } }

da.selectcommand = cmd;

before da.fill(ds);

c#

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -