C# Programming
11-07-2009, 08:51 AM
Hi!
I'm trying to check my database if an entry on a field is already exists in the DB.
My Sql command is this:
string Sqlcommand = "SELECT Name FROM Students WHERE Id LIKE '" + TextBox1 + "'";
and I'm executing this as follows
SqlCeCommand com = new SqlCeCommand(Sqlcommand, conn);
SqlCeDataAdapter da = new SqlCeDataAdapter(com);
after these, just to be sure, I want to check if the query returned some rows or not
what should I do?
note: I've tried these ->
DataSet s = new DataSet();
da.Fill(s);
if( s == null)
if( s.Tables.Count == 0)
if( da == null)
can anybody help? :/
I'm trying to check my database if an entry on a field is already exists in the DB.
My Sql command is this:
string Sqlcommand = "SELECT Name FROM Students WHERE Id LIKE '" + TextBox1 + "'";
and I'm executing this as follows
SqlCeCommand com = new SqlCeCommand(Sqlcommand, conn);
SqlCeDataAdapter da = new SqlCeDataAdapter(com);
after these, just to be sure, I want to check if the query returned some rows or not
what should I do?
note: I've tried these ->
DataSet s = new DataSet();
da.Fill(s);
if( s == null)
if( s.Tables.Count == 0)
if( da == null)
can anybody help? :/