string oConnX = @"Provider=VFPOLEDB.1; Data Source=" + @"C:\DISA\DIS2012"; string oSelX = "Select AAP_TITLE from DFAAP WHERE AAP_DATEBR >= ? "; using (OleDbConnection connection = new OleDbConnection(oConnX )) { OleDbCommand oCommX = new OleDbCommand(oSelX, connection ); OleDbDataAdapter oDaX = new OleDbDataAdapter(oCommX ); DateTime dtX = DateTime.Now; oCommX.Parameters.Add(new OleDbParameter("?MyDate ", dtX)); DataSet oDsX = new DataSet(); oDaX.Fill(oDsX); } OleDbCommand oCommX = new OleDbCommand(); >> string oConnX = @"Provider=VFPOLEDB.1; Data Source=" + @"C:\DISA\DIS2012"; >> string oSelX = "Select AAP_TITLE from DFAAP WHERE AAP_DATEBR >= ? "; >> DateTime dtX = DateTime.Now; >> oCommX.Parameters.Add(new OleDbParameter("?MyDate ", dtX)); >>OleDbDataAdapter oDaX = new OleDbDataAdapter(oSelX, oConnX); >>DataSet oDsX = new DataSet(); >>oDaX.Fill(oDsX);>Gerard
>>Hi Bill. My code is below: >> >> OleDbCommand oCommX = new OleDbCommand(); >> string oConnX = @"Provider=VFPOLEDB.1; Data Source=" + @"C:\DISA\DIS2012"; >> string oSelX = "Select AAP_TITLE from DFAAP WHERE AAP_DATEBR >= ? "; >> DateTime dtX = DateTime.Now; >> oCommX.Parameters.Add(new OleDbParameter("?MyDate ", dtX)); >>OleDbDataAdapter oDaX = new OleDbDataAdapter(oSelX, oConnX); >>DataSet oDsX = new DataSet(); >>oDaX.Fill(oDsX); >> >>If I Change the where clause to 1=1, rows are selected fine >>The AAP_DATEBR is a Date Field in a DBF thats part of a .DBC >>>>
>>>>Hi Borislav >>>>======================================================= >>>>string oSel = "Select Myfield1,MyDate from MYTable WHERE MyDate <= ? "; >>>>DateTime dt = DateTime.Now; >>>>oComm.Parameters.Add(new OleDbParameter("?MyDate ", dt)); >>>>======================================================= >>>> >>>>Still get a message: No value given for one or more required parameters >>>>Beginnig to think that maybe you cannot use parameters with OleDb and Foxpro and a Date Field and maybe I have to change >>>> to stringing in everything (and I know..leave it open to Sql Injection etc ) >>>>What do you think ? >>>>Have you yourself ever got OLEDB with a Date Parameter to work ? >>>> >>>>Regards, >>>>Gerard >>>>>>>>
>>>>>string oSel = "Select Myfield1,MyDate from MYTable WHERE MyDate <= ? "; >>>>>DateTime dt = DateTime.Now; >>>>>oComm.Parameters.Add(new OleDbParameter("?MyDate ", dt)); >>>>>>>>>>