OdbcDataReader q = dbc.Query("SELECT * FROM `posts` WHERE `id`=" + id.ToString());
if (q.RecordsAffected < 1)
{
this.Exists = false;
}
else
{
this.Exists = true;
this.Author = q.GetString(6);
}
The server returns No data exists for the row/column.
My database table is structured like this (screencap from phpMyAdmin)
By the way, dbc
is just a database connection class of mine; the Query()
function is this:
public OdbcDataReader Query(string QueryStr)
{
OdbcCommand q = new OdbcCommand(QueryStr, conn);
OdbcDataReader r = q.ExecuteReader();
return r;
}