heres how I declare aCommand
Originally Posted by GanglyLamb
I already tested the query manually it works so i don't see how the initialization of the object is the problem.
OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\whatever");
The function actually works fine if the query returns one record, it is when the query returns no records that the problem occuers. I thought it might just return a null string or something, but appearently not. I don't know how to process the "nothing"
I tried doing this, it also didn't work
public string getScalar (string query)
OleDbCommand aCommand = new OleDbCommand(query, aConnection);
object num = aCommand.ExecuteScalar()/*.ToString()*/;
string none = "none";
if(num.GetType() != none.GetType())