我创建了Web应用程序,在这个应用程序中有一部分插入大字符串(字符串超过10000个字符)的值使用oledb查询到excel表。 我已经尝试了下面的代码,但我得到了
“该字段太小,无法接受您尝试的数据量 加。尝试插入或粘贴较少的数据。“此错误。
string con = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Test.xls;Extended Properties=Excel 8.0;";
using (OleDbConnection connection = new OleDbConnection(con))
{
connection.Open();
// string str = "bsdhjbdshjfbdhjsfsbjfsbfhjsfbjhbfjhbfjhsbhfshjfjfbjhfjshfjhsfjshfjdhsfjsjfdsjfj";
string str = "bsdhjbfdggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggdfgdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddshjfbdhjsfsbjfsbfhjsfbjhbfjhbfjhsbhfshjfjfbjhfjshfjhsfjshfjdhsfjsjfdsjfjjglfgjlkjgoig/dfdfgflkdglkfgfjlkgkjldfglklfggjoitglklkfjdgoidjgldmgldgogloieewrlkrj/k.asuhdidkahdsdhisuahdiuhsikudhiusadhiusdhishdisiduhidhsihahudihiuhisahdiuhiai";
string sqlStquery = "Insert into [Sheet1$] ([ID],[Name]) Values ('" + 0 + "','" + str + "')";
OleDbDataAdapter dbadapter = new OleDbDataAdapter(sqlStquery, connection);
dbadapter.SelectCommand.ExecuteNonQuery();
dbadapter.Dispose();
connection.Close();
connection.Dispose();
}
所以任何人都可以建议我如何使用Oledb Query在Excel表格中插入超过10000个字符串值。