2014-01-24 193 views
1

我有ShowGrid()RowEditingRowCancelingEdit,但它們是正確的附近有語法錯誤('

當執行網站,我得到這個一般的錯誤,我想不通:?

不正確語法接近'(')

描述:在執行當前Web請求期間發生未處理的異常請查看堆棧跟蹤以獲取有關該錯誤的更多信息以及源代碼的來源

異常詳細信息:System.Data.SqlClient.SqlException:附近有語法錯誤('。

Protected Sub GridView1_OnRowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GridView1.RowUpdating 
    Dim connStr, cmdStr As String 
    connStr = "XXXXX" 
    cmdStr = "UPDATE OrbitDates SET ([email protected],[email protected],[email protected],[email protected]) WHERE [email protected];" 
    Try 
     Using conn As New SqlConnection(connStr) 
      Using cmd As New SqlCommand(cmdStr, conn) 
       conn.Open() 
       cmd.Parameters.AddWithValue("@ido", GridView1.Rows(e.RowIndex).Cells(0).Text) 
       cmd.Parameters.AddWithValue("@JD", GridView1.Rows(e.RowIndex).Cells(1).Text) 
       cmd.Parameters.AddWithValue("@Xecl1", GridView1.Rows(e.RowIndex).Cells(2).Text) 
       cmd.Parameters.AddWithValue("@Yecl1", GridView1.Rows(e.RowIndex).Cells(3).Text) 
       cmd.Parameters.AddWithValue("@Zecl1", GridView1.Rows(e.RowIndex).Cells(4).Text) 

       cmd.ExecuteNonQuery() 
       conn.Close() 
       cmd.Dispose() 
       conn.Dispose() 
      End Using 
     End Using 
    Catch ex As Exception 
     Throw ex 
    End Try 
    ViewState("edit") = e.RowIndex 
    ShowGrid() 
End Sub 

回答