VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,711 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Im on vb.net framework version 4.8.1
Using an online database
code
Public Class register
Private cmd As SqlCommand
Private Sub register_btn_Click(sender As Object, e As EventArgs) Handles register_btn.Click
Dim con As New SqlConnection
Dim unused As New SqlCommand
con.ConnectionString = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\XXXXX\Desktop\XXXXXXX\XXXXXXXX\Database1.mdf;Integrated Security=True"
con.Open()
If (fname.Text = "" Or lname.Text = "" Or gender.Text = "" Or phone.Text = "" Or email.Text = "" Or password.Text = "") Then
MessageBox.Show("XXXXXXX")
Else
cmd = New SqlCommand("INSERT INTO users values(´" & fname.Text & "´,´" & lname.Text & "´,´" & gender.Text & "´,´" & phone.Text & "´,´" & email.Text & "´,´" & password.Text & "´) ", con)
cmd.ExecuteNonQuery()
MsgBox("XXXXX", MsgBoxStyle.Information, "XXXXXXX")
Me.Hide()
Login.Show()
fname.Clear()
lname.Clear()
phone.Clear()
email.Clear()
password.Clear()
End If
con.Close()
End Sub
Try normal apostrophes ' instead of ´.
To avoid further major problems, consider the Parameterized Queries instead of dangerous string concatenations.