嗨,这是代码,它没有错误但是当你检查数据库时没有添加任何内容
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Create_btn.Click
Call getConnect()
If New_Username.Text = "" And New_Password.Text = "" And New_Pass_Code.Text = "" Then
MsgBox("check the empty textbox or wrong Admin Password", MsgBoxStyle.Critical, "needed")
Else
con.Open()
sql = "INSERT into Accounts (Username, Password, Pass_Code) values('" _
& New_Username.Text & "','" _
& New_Password.Text & "' , '" _
& New_Pass_Code.Text & "')"
Dim sqlcomd As New SqlClient.SqlCommand
sqlcomd.CommandText = sql
sqlcomd.Connection = con
sql = sqlcomd.ExecuteNonQuery
MsgBox("data saved")
con.Close()
End If
答案 0 :(得分:0)
尝试检查您的连接字符串。数据可能会保存到另一个数据库。