Revathi Parvathi

Revathi Parvathi

  • NA
  • 323
  • 64.3k

No value given for one or more required parameters error C#

Oct 5 2017 2:44 AM
Hi,
 No value given for one or more required parameters error C# while executiong query.Please help me.
 
string filePath = "D:\\RAGHUGROUPS-QUICKBOOKS\\fwbrandwiseordersampletemplatesforsage\\Copy of PDF Brandwise Orders for MIke.xlsx";
string Access = "C:\\Users\\test\\Documents\\BrandWise_SalesOrder.mdb";
string Excel = "D:\\RAGHUGROUPS-QUICKBOOKS\\fwbrandwiseordersampletemplatesforsage\\Copy of PDF Brandwise Orders for MIke.xlsx";
string connect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Excel + ";Extended Properties=Excel 12.0;";
using (OleDbConnection conn = new OleDbConnection(connect))
{
using (OleDbCommand cmd = new OleDbCommand())
{
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO [MS Access;Database=" + Access + "].[Excel_table] SELECT OrderDate,Customer,TotalItems,CreditSheet,OrderTotal FROM [Sheet1$]";
conn.Open();
cmd.ExecuteNonQuery();
}
}

Answers (1)