Hi i am trying to update a excel file using the oledb connections. But i am getting the following error:
"No value given for one or more required parameters." This is my code:String sConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(@"TempUploads\" + hdnExcelName.Value) + ";Extended Prop开发者_如何学运维erties='Excel 8.0;HDR=NO'";
OleDbConnection objConn = new OleDbConnection(sConnectionString);
objConn.Open();
string sql = "update [Sheet1$] set [A8]='apple1.jpg'";
OleDbCommand objCmdSelect = new OleDbCommand(sql, objConn);
objCmdSelect.ExecuteNonQuery();
objConn.Close();
thanks in advance
With HDR=No, the various columns are referred to as F1, F2, F3 etc. A8 is not suitable.
The SQL should be on the lines of:
UPDATE [Sheet1$] SET F1='apple1.jpg'
WHERE F2='Blah'
EDIT re comment
strSQL = "SELECT f1 From [Sheet1$a8:a8]"
精彩评论