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
Post a Comment