1

asp.net c# で Microsoft.Jet.OLEDB.4.0 を使用して csv ファイルを読み込もうとしていますが、「1 つ以上の必須パラメーターに値が指定されていません」というエラーが表示されます。

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

ファイルには、クエリ文字列で指定されたすべての列名が含まれています。列名の違いを確認しましたが、違いは見つかりませんでした。

ここに私が読み込もうとしているcsvファイルがあります:


誰かがこの問題を解決するのを手伝ってください....

4

2 に答える 2

0

ブレークポイントを設定して、データベースに適用するクエリ文字列の内容を確認します

于 2013-09-06T09:39:26.710 に答える
0

列名を配置します

例えば

string query = string.Concat("SELECT [a_id], EpisodeId, [Logged], 
[appintmentfollowporreferral] as [Appointment], AppointmentType, AppointmentDateAndTime,
AppointmentWith, [Outcome], RTWStatus, Completed FROM " + appointmentReportsFileName);

また、指定されたすべての列が存在するかどうか、またはテーブル名変数 ( appointmentReportsFileName) に有効な値があるかどうかを確認します

于 2013-09-06T05:13:12.383 に答える