Below I provide my database schema, the database data currently inserted (which is only one record), and the code I am running. It is a very simple setup, but instead of returning the one record in the database, it returns nothing. Anyone have any idea why? I am on my wit's end here...
Table: Subcontractor
Columns: listed below in (name type) format.
ID guid,
BusinessName varchar(50),
Address varchar(200),
City varchar(50),
State varchar(50),
ZipCode varchar(50),
Contact varchar(50),
Phone varchar(50),
Fax varchar(50),
Email varchar(200),
GLOPolicy bit,
GLOLimit bigint,
GLOExpiration datetime,
ALPolicy bit,
ALLimit bigint,
ALExpiration datetime,
WCPolicy bit,
WCLimit bigint,
WCExpiration datetime,
ULPolicy bit,
ULLimit bigint,
ULExpiration datetime,
Notes varchar(15000)
=====
I have one record in my database, as follows.
ID "7b143c19-ad66-46ad-b587-db0bee98cf1e"
BusinessName "1"
Address "1"
City "1"
State "1"
ZipCode "1"
Contact NULL
Phone NULL
Fax NULL
Email NULL
GLOPolicy False (0)
GLOLimit NULL
GLOExpiration NULL
ALPolicy False (0)
ALLimit NULL
ALExpiration NULL
WCPolicy False (0)
WCLimit NULL
WCExpiration NULL
ULPolicy False (0)
ULLimit NULL
ULExpiration NULL
Notes NULL
===== *I am attempting the following query, and it returns nothing, when it should obviously return the only record, shown above.*
String ID = "7b143c19-ad66-46ad-b587-db0bee98cf1e";
DataTable dt = sqliteQuery.selectFromDatabase("*", "WHERE ID = '" + ID + "'");
And the code for the above method is...
public DataTable selectFromDatabase(String column, String filter)
{
string SQL = "SELECT " + column + " FROM SUBCONTRACTOR " + filter;
SQLiteCommand cmd = new SQLiteCommand(SQL);
cmd.Connection = connection;
SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
DataSet ds = new DataSet();
try
{
da.Fill(ds);
DataTable dt = ds.Tables[0];
return dt;
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
return null;
}
finally
{
cmd.Dispose();
connection.Close();
}
}