I'm trying to insert Username, Password, and Account Balance data into my SQL Database. The code debugs correctly, but when I run the program, I'm not able to use the information I registered with to login with. (I have a separate form that lets me login with a username and password, and that works fine, so it has to be something to do with my register form.) Was this enough information?
Code:Imports System.Data.SqlClient Public Class register Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Then MsgBox("Please enter text into *all* text boxes.") Else Dim conn As New SqlConnection Dim comm As New SqlCommand Dim adapter As New SqlDataAdapter Dim ds As New DataSet conn.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" comm.CommandText = "INSERT INTO users (username,password,balance) VALUES (" & TextBox1.Text & "," & TextBox2.Text & "," & TextBox3.Text & ")" conn.Open() MsgBox("Registered!") End If Me.Close() End Sub End Class




Reply With Quote