VB.NET 1.1 프레임 워크에서 개발 된 오래된 웹 응용 프로그램을 사용하고 있습니다. 체크 박스에 문제가 있습니다. ASP.NET에서 작동하는 체크 박스를 얻는 방법
나는이 다음 내 체크 박스 코드 : 내OnCheckChanged
이벤트에 대한
<asp:TemplateColumn HeaderText="Reviewed">
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemTemplate>
<asp:checkbox ID="chkAppRev" Runat="server"
OnCheckedChanged="onCheckChange" AutoPostBack="True" />
</ItemTemplate>
</asp:TemplateColumn>
이 :
Public Sub onCheckChange(ByVal sender As Object, ByVal e As EventArgs)
Dim strSQL As String = String.Empty
Dim inbox As CheckBox = CType(sender, CheckBox)
Dim dgItem As DataGridItem = CType(inbox.NamingContainer, DataGridItem)
Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(ConfigurationSettings.AppSettings("CONNECTIONSTRING"))
Try
'--update checkbox field on record in database
conn.Open()
If inbox.Checked = True Then
strSQL = "Update AppUserJobs Set AppChecked=1 " & _
"Where AppUserId=" & Convert.ToInt32(dgItem.Cells(9).Text) &
" and JobId=" & Convert.ToInt32(dgItem.Cells(10).Text)
Else
strSQL = "Update AppUser Set AppChecked=0 " & _
"Where AppUserId=" & Convert.ToInt32(dgItem.Cells(9).Text) &
" and JobId=" & Convert.ToInt32(dgItem.Cells(10).Text)
End If
Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(strSQL, conn)
Dim intRec As Integer = cmd.ExecuteNonQuery()
conn.Close()
Catch ex As Exception
Finally
If (conn.State = ConnectionState.Open) Then
conn.Close()
End If
End Try
BindData()
End Sub
내가 ASP 코드와 다른 또 다른 체크 박스를 추가 할 때까지이 모두가 잘 작동 oncheckchanged
메서드를 사용하면 쿼리를 건너 뛰는 것처럼 보입니다.
내가 놓친 아이디어가있는 사람이 있습니까?
문제가 존재하기 전에 보이는대로 코드를 보면서 어떻게 문제를 볼 수 있습니까? 변경 한 후에 코드를 게시하십시오. – Guffa
SQL 주입 FTW! –
안녕하세요 Guffa 감사합니다. 글자 수 한도로 인해 더 이상 코드를 게시 할 수 없지만 단순히 다른 ID로 확인란 코드를 복제하면 코드가 OnCheckChanged 메서드의 쿼리를 건너 뛸 때 코드가 깨집니다. –