Hi everyone,
Hopefully this is the right forum to use.
I am programming in C# [Win forms] and I've been racking my brain and searching for the right answer to extract my information according to after a certain input date. the problem is that when I hard-code the numeric date, there is no problem at all and all requested information is displayed correctly. But when I try to pass the variable (parameter) as an integer as in the code that follows, the syntax generates this error "No value given for one or more required parameters".
Guess what I'm trying to say is what is the right code that I am missing to extract the tables. MS Access is the db and I am using C#. The fustrating Integer is "Start_Date ". There is also a blocked out code where I do have success with the hard-coded date.
Thank you all for any and all help.
[code=c#]
public void Extract_Close_T able_All_By_Dat e(int Start_Date)
{
try
{
OleDbConnection DB_Connection = new OleDbConnection (@"Provider = Microsoft.Jet.O LEDB.4.0;Data Source=C:\HOST 000.MDB");
DB_Connection.O pen();
//TO CONTAIN RELATED DATA TABLES, ROWS, & COLUMNS
DataSet DB_DataSet = new DataSet();
//EXTRACT TABLE
OleDbDataAdapte r Adapter_Zone = new OleDbDataAdapte r("SELECT * FROM [CLOSED_TABLE_ZO NE] WHERE [TABLE_START_DAT E] >= Start_Date", DB_Connection);
// OleDbDataAdapte r Adapter_Zone = new OleDbDataAdapte r("SELECT * FROM [CLOSED_TABLE_ZO NE] WHERE [TABLE_START_DAT E] = 20070423", DB_Connection);
Adapter_Zone.Fi ll(DB_DataSet, "CLOSED_TABLE_Z ONE");
//EXTRACT TABLE ITEMS
OleDbDataAdapte r Item_Zone = new OleDbDataAdapte r("SELECT * FROM [CLOSED_TABLE_IT EMS]", DB_Connection);
Item_Zone.Fill( DB_DataSet, "CLOSED_TABLE_I TEMS");
//RELATION
DataRelation Table_Relations = DB_DataSet.Rela tions.Add("CLOS ED_TABLE_ITEMS" , DB_DataSet.Tabl es["CLOSED_TABLE_Z ONE"].Columns["TABLE_ID"],
DB_DataSet.Tabl es["CLOSED_TABLE_I TEMS"].Columns["TABLE_ID"],false);
//
Table_Relations .Nested = true;
[/code]
Hopefully this is the right forum to use.
I am programming in C# [Win forms] and I've been racking my brain and searching for the right answer to extract my information according to after a certain input date. the problem is that when I hard-code the numeric date, there is no problem at all and all requested information is displayed correctly. But when I try to pass the variable (parameter) as an integer as in the code that follows, the syntax generates this error "No value given for one or more required parameters".
Guess what I'm trying to say is what is the right code that I am missing to extract the tables. MS Access is the db and I am using C#. The fustrating Integer is "Start_Date ". There is also a blocked out code where I do have success with the hard-coded date.
Thank you all for any and all help.
[code=c#]
public void Extract_Close_T able_All_By_Dat e(int Start_Date)
{
try
{
OleDbConnection DB_Connection = new OleDbConnection (@"Provider = Microsoft.Jet.O LEDB.4.0;Data Source=C:\HOST 000.MDB");
DB_Connection.O pen();
//TO CONTAIN RELATED DATA TABLES, ROWS, & COLUMNS
DataSet DB_DataSet = new DataSet();
//EXTRACT TABLE
OleDbDataAdapte r Adapter_Zone = new OleDbDataAdapte r("SELECT * FROM [CLOSED_TABLE_ZO NE] WHERE [TABLE_START_DAT E] >= Start_Date", DB_Connection);
// OleDbDataAdapte r Adapter_Zone = new OleDbDataAdapte r("SELECT * FROM [CLOSED_TABLE_ZO NE] WHERE [TABLE_START_DAT E] = 20070423", DB_Connection);
Adapter_Zone.Fi ll(DB_DataSet, "CLOSED_TABLE_Z ONE");
//EXTRACT TABLE ITEMS
OleDbDataAdapte r Item_Zone = new OleDbDataAdapte r("SELECT * FROM [CLOSED_TABLE_IT EMS]", DB_Connection);
Item_Zone.Fill( DB_DataSet, "CLOSED_TABLE_I TEMS");
//RELATION
DataRelation Table_Relations = DB_DataSet.Rela tions.Add("CLOS ED_TABLE_ITEMS" , DB_DataSet.Tabl es["CLOSED_TABLE_Z ONE"].Columns["TABLE_ID"],
DB_DataSet.Tabl es["CLOSED_TABLE_I TEMS"].Columns["TABLE_ID"],false);
//
Table_Relations .Nested = true;
[/code]
Comment