改了一下,还是出错
Private Sub KcbDataGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles KcbDataGrid.ItemCommand
Dim ename As String = Session("ename")
Dim KchCell As TableCell = e.Item.Cells(0)
' Dim kcmcell As TableCell = e.Item.Cells(1)
Dim xqcell As TableCell = e.Item.Cells(6)
Dim conn As New SqlConnection("server=NT-DATA2;uid=sa;password=zjzx;database=student")
Dim comm As New SqlCommand("insert into sele_xkxx(xh,kch,cj,xq) values (ename,kchcell,0,xqcell)", conn)
conn.Open()
comm.ExecuteNonQuery()
End Sub
在此上下文中不允许使用 'ename'。此处只允许使用常量、表达式或变量。不允许使用列名。 行 108: comm.ExecuteNonQuery()
Private Sub KcbDataGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles KcbDataGrid.ItemCommand
Dim ename As String = Session("ename")
Dim KchCell As TableCell = e.Item.Cells(0)
' Dim kcmcell As TableCell = e.Item.Cells(1)
Dim xqcell As TableCell = e.Item.Cells(6)
Dim conn As New SqlConnection("server=NT-DATA2;uid=sa;password=zjzx;database=student")
Dim comm As New SqlCommand("insert into sele_xkxx(xh,kch,cj,xq) values (ename,kchcell,0,xqcell)", conn)
conn.Open()
comm.ExecuteNonQuery()
End Sub
在此上下文中不允许使用 'ename'。此处只允许使用常量、表达式或变量。不允许使用列名。 行 108: comm.ExecuteNonQuery()
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货