2005-05-01, 12:56 PM
im trying to get the current tv show from the database using this code
but i keep getting this error
the problem is to do with the @Start and @End datetimes, im not sure how im meant to set this, anyone know where im going wrong?
TIA
reven.
Code:
OleDbConnection conn = new OleDbConnection(GBPVRDB_CONNECTION_STRING);
OleDbCommand cmd = new OleDbCommand("SELECT name, subtitle FROM PROGRAMME WHERE start_time >= @Start AND end_time < @End",conn);
cmd.Parameters.Add("@Start", Sy{tem.DateTime.Now);
command.Parameters.Add("@End", System.DateTime.Now);
conn.Open();
OleDbDataReader reader = cmd.ExecuteReader();
string title = "";
string subtitle = "";
while(reader.Read())
{
title = reader.GetString(0);
subtitle = reader.GetString(1);
}
conn.Close();
but i keep getting this error
Code:
2/05/2005 12:53:22 a.m..782 ERROR [2] Error: msg=0x100 (WM_KEYDOWN) hwnd=0x370254 wparam=0x71 lparam=0x1 result=0x0 : No value given for one or more required parameters. : at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at LCDPlugin.Database.GetShow(String oid) in c:\xmltv\my lcd\database.cs:line 59
the problem is to do with the @Start and @End datetimes, im not sure how im meant to set this, anyone know where im going wrong?
TIA
reven.