|
The first thing I see is a call to ExecuteNonQuery() against a select statement. That one call is probably breaking your whole page; this method never returns data from the db to the caller. There are three methods on a SQL command, which all send the SQL down to the database, but differ in terms of results. NonQuery is meant for delete, update, or insert statements, where you want to do work, but not get info. Scalar is when you only want a single value, say if you call Select @@Identity right after an insert. And then just regular Execute does the work at the db, and gives your program access to whatever data is sent back.
MessageBox ... that renders to client script, no? I haven't used this in ASPx myself, so I'm not familiar with that one.
Last thing I noticed; I don't know what type of object userRS is, but ADO.NET dropped the concept of record sets. You can work with DataTables, DataSets ( which are collections of DataTables that can have relationships ), and DataReaders. For a query that only returns one row, it's not going to matter very much which you use, but as far as I know, you aren't able to use recordset style coding anymore. I could be wrong.
|