Incorrect syntax near the keyword user hatası visual studio
Bu benim User.vb kodum
Imports System.Data.SqlClient
Public Class User
Dim connect As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=model;Integrated Security=True")
Private _username As String
Private _sifre As String
Public Property Username As String
Get
Return _username
End Get
Set(value As String)
_username = value
End Set
End Property
Public Property Sifre As String
Get
Return _sifre
End Get
Set(value As String)
_sifre = value
End Set
End Property
Sub KullaniciGirisi(kAdi As String, Password As String)
Username = kAdi
Sifre = Password
If Username = "" Or Sifre = "" Then
MessageBox.Show("Kullanıcı adı ve/veya şifre alanı boş geçilemez!", "Uyarı")
Else
If connect.State = ConnectionState.Closed Then
connect.Open()
End If
Dim komut As New SqlCommand("select *from user where username='" & Username & "'", connect)
Dim okuyucu As SqlDataReader = komut.ExecuteReader
If okuyucu.Read Then
If okuyucu(1) = Sifre Then
MessageBox.Show("İşlem Başarılı!", "Giriş Yapılıyor")
loginPage.clear()
Else
MessageBox.Show("Şifrenizi kontrol ediniz!", "Uyarı")
End If
Else
MessageBox.Show("Bilgilerinizi kontrol ediniz!", "Uyarı")
End If
End If
End Sub
End Class
Bu da benim loginPage.vb kodum
Public Class loginPage
Private Sub PictureBox1_Click(sender As Object, e As EventArgs)
End Sub
Private Sub lblKapat_Click(sender As Object, e As EventArgs) Handles lblKapat.Click
Me.Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnRegister.Click
frmRegiter.ShowDialog()
End Sub
Private Sub btnhatirla_CheckedChanged(sender As Object, e As EventArgs) Handles btnhatirla.CheckedChanged
End Sub
Private Sub resetPassword_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles resetPassword.LinkClicked
frmReset_password.ShowDialog()
End Sub
Private Sub password_TextChanged(sender As Object, e As EventArgs) Handles password.TextChanged
End Sub
Private Sub loginPage_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Dim K As New User
Sub clear()
For Each control As Control In Me.Controls
If TypeOf control Is TextBox Then
control.Text = ""
End If
Next
End Sub
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
K.KullaniciGirisi(userName.Text, password.Text)
End Sub
End Class
ClientConnectionId:54d7e125-c03a-40de-ae7e-b4cdf1fe1672
Error Number:156,State:1,Class:15</ExceptionString><DataItems><Data><Key>HelpLink.ProdName</Key><Value>Microsoft SQL Server</Value></Data><Data><Key>HelpLink.ProdVer</Key><Value>14.00.1000</Value></Data><Data><Key>HelpLink.EvtSrc</Key><Value>MSSQLServer</Value></Data><Data><Key>HelpLink.EvtID</Key><Value>156</Value></Data><Data><Key>HelpLink.BaseHelpUrl</Key><Value>http://go.microsoft.com/fwlink</Value></Data><Data><Key>HelpLink.LinkId</Key><Value>20476</Value></Data></DataItems></Exception></TraceRecord>
'System.Data.SqlClient.SqlException' türünde bir yakalanamayan özel durum, System.Data.dll öğesinde oluştu
Incorrect syntax near the keyword 'user'.
yukarıdaki de hata kodu
Dosyayı da alta koydum.