Reputation: 51
I am trying to read a csv file using Microsoft.Jet.OLEDB.4.0 in asp.net c# but i am getting an error as "No value given for one or more required parameters."
my select query :
string query = string.Concat("SELECT a_id, EpisodeId, Logged, [appintmentfollowporreferral] as Appointment, AppointmentType, AppointmentDateAndTime, AppointmentWith, Outcome, RTWStatus, Completed FROM " + appointmentReportsFileName);
here is the code that i am using to read the csv file :
string connString = string.Concat("Provider=Microsoft.Jet.OLEDB.4.0;", "Data Source=", filePath, ";", "Extended Properties=\"text;HDR=Yes;FMT=D=Delimited(,)\"");
//create an OleDbDataAdapter to execute the query
OleDbDataAdapter dAdapter = new OleDbDataAdapter(query, connString);
//fill the DataTable
dAdapter.Fill(dTable);
dAdapter.Dispose();
here is csv file that i am trying to read :
please some one help me in solving this problem....
Upvotes: 1
Views: 5639
Reputation: 2610
Place your column name
e.g.
string query = string.Concat("SELECT [a_id], EpisodeId, [Logged],
[appintmentfollowporreferral] as [Appointment], AppointmentType, AppointmentDateAndTime,
AppointmentWith, [Outcome], RTWStatus, Completed FROM " + appointmentReportsFileName);
Also check if all given columns exist or the table name variable (appointmentReportsFileName
) has valid value
Upvotes: 0
Reputation: 2578
Set Breakpoint check what you have in query string to apply in your db
Upvotes: 0