0

Excelのアップロードに次のコードを使用しています

 OleDbConnection sSourceConnection;
            string properties = "Excel 8.0; HDR=NO; IMEX=1;";//properties set for connection to excel
            string sSourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + filePath + ";Extended Properties=\"" + properties + "\"";
            sSourceConnection = new OleDbConnection(sSourceConstr);//creating the OLEDB connection
            try
            {
                //select statement to select data from the first excel sheet
                string sql = string.Format("Select * FROM [{0}]", "Sheet1$");

                //commands to fill the dataset with excel data
                OleDbDataAdapter excelAdapter = new OleDbDataAdapter();
                OleDbCommand command = new OleDbCommand(sql, sSourceConnection);
                sSourceConnection.Open();
                excelAdapter.SelectCommand = command;
                excelAdapter.Fill(dSet, EXCEL_DATA);

約 300 件のレコードをアップロードする必要があります。1 つの列にいくつかのテキスト コメントがあります。コメントの長さは、10 文字から 1000 文字までさまざまです。ただし、長さが 255 を超えるコメントはすべて、その列で切り捨てられています。

この投稿Excel cell-values are truncated by OLEDB-providerを使用してレジストリ設定を変更しましたが、機能しませんでした。

また、投稿OleDB & mixed Excel datatypes : missing dataで言及されているすべてを試しましたが、まだ何も機能しません。

4

2 に答える 2

0

私はACEエンジンを使用していたので、レジストリを更新する正しい場所は

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Access Connectivity Engine\Engines\Excel\TypeGuessRowsHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Access Connectivity Engine\Engines\Excel\TypeGuessRows

于 2013-03-18T09:10:59.230 に答える