Click to See Complete Forum and Search --> : ExecuteScalar


awaismalik82
July 2nd, 2004, 12:55 AM
String query1 = "Select COUNT(USERNAME) As TEMP From EB_USERROLES Where ROLEID="+roleInfoObj.id;

this is my query and when i call the executeScalar method as,

eBrokerageCommand = new SqlCommand (query,eBrokerageConn);

int rowCount = (int) eBrokerageCommand.ExecuteScalar();

it gives me an execption. I really dont know whts wrong plz help!

Awais Malik

BinaryAnge
July 2nd, 2004, 12:33 PM
use a try catch around your code an catch the SqlException. That exception object will have an error collection you can enumerate thru and find out exactly what your problem is.