로그 아웃 할 때 데이터베이스에서 사용자 이름을 삭제하려고합니다. 내 코드는 작동하지 않는 다음과 같습니다. 나는 당신의 쿼리가 있어야한다 그래서 문자열 리터럴이 필요MySQL 데이터베이스에서 ID 삭제
Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim Query As String
Dim con As MySqlConnection = New MySqlConnection("Server=localhost;User ID=root;Password=*Mypassword*;Database=myusers")
con.Open()
Query = "Delete FROM users WHERE name =" + loginuser.Text
'Table = users
'Name = Varchar(20)
'loginuser.text = Name (username)
Dim cmd As MySqlCommand = New MySqlCommand(Query, con)
MsgBox(Query)
Dim i As Integer = cmd.ExecuteNonQuery()
If (i > 0) Then
MsgBox("Record is Successfully Deleted")
Else
MsgBox("Record is not Deleted")
End If
con.Close()
End Sub
''; DROP TABLE users; '를 로그인 상자에 입력하면 어떻게됩니까? 당신은 실제로 해킹 당하고 있습니다. –