The problem is when the query returns nothing. I tried a s == NULL case , but it said null was not valid for a string or something. I also tried saving the return as an "object" type, not exactly sure how that works, then converting it to a string only if the object is not NULL, that didn't work either.Code:public string getScalar (string query) { OleDbCommand aCommand = new OleDbCommand(query, aConnection); aConnection.Open(); string s= aCommand.ExecuteScalar().ToString(); aConnection.Close(); return s; }
any help appriciated. Thanks.



LinkBack URL
About LinkBacks


