Pravin
Pravin

Reputation: 51

Oledb Exception - No value given for one or more required parameters

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();

the file contains all the column names specified in the query string, i have checked the column names for any difference but i couldn't find any difference.

here is csv file that i am trying to read :


please some one help me in solving this problem....

Upvotes: 1

Views: 5639

Answers (2)

Ronak Patel
Ronak Patel

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

senthilkumar2185
senthilkumar2185

Reputation: 2578

Set Breakpoint check what you have in query string to apply in your db

Upvotes: 0

Related Questions