OleDbCommand.ExecuteScalar return problems
Code:
public string getScalar (string query)
{
OleDbCommand aCommand = new OleDbCommand(query, aConnection);
aConnection.Open();
string s= aCommand.ExecuteScalar().ToString();
aConnection.Close();
return s;
}
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.
any help appriciated. Thanks.