-1

您好,代码没有错误,但是当您检查数据库时,没有添加任何内容

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
4

1 回答 1

0

尝试检查您的连接字符串。数据可能正在保存到另一个数据库。

于 2013-08-26T07:07:07.150 回答