开发者

No value given for one or more required parameters

开发者 https://www.devze.com 2022-12-20 21:49 出处:网络
Hi i am trying to update a excel file using the oledb connections. But i am getting the following error:

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]"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号