How to get rid of “No value given for one or more required parameters”

前端 未结 2 1296

I have the following code,

When the update button in Gridview is clicked , it throws an error: No value given for one or more required parameters

相关标签:
2条回答
  • 2021-01-24 13:11

    If you look at the below link, under Remarks it says "A common way to use these collections is to HTML-encode the values supplied by the user before they are stored in the data source."

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowupdating.aspx

    0 讨论(0)
  • 2021-01-24 13:19

    From OleDbCommand.Parameters:

    The OLE DB .NET Provider does not support named parameters for passing parameters to an SQL statement or a stored procedure called by an OleDbCommand when CommandType is set to Text. In this case, the question mark (?) placeholder must be used. For example:

    SELECT * FROM Customers WHERE CustomerID = ?
    

    So try using unnamed parameters instead (see the documentation for a full example).

    0 讨论(0)
提交回复
热议问题