sir
i am new in here
i got an error when i try to search a phone no from the database
the error is
"conversion from string phoneno to type integer is invalid
the phoneno with type nvarchar(11) and the code is
plz tell me how to solv this
i am new in here
i got an error when i try to search a phone no from the database
the error is
"conversion from string phoneno to type integer is invalid
the phoneno with type nvarchar(11) and the code is
Code:
Dim Con As SqlConnection = New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Vu Data\CS-619 Project\Miscall Log In\DBMSMissxcall.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
Con.Close()
' '''' [ this code is generating error]
Dim cmd As New SqlClient.SqlCommand
Dim DaLogin As New SqlClient.SqlDataAdapter
Dim dtable As New DataTable
cmd.CommandText = "SELECT * from Users WHERE PhoneNo = @loginuser"
Dim user As String = txtloginuser.Text
cmd.Parameters.AddWithValue("@loginuser", user)
Con.Open()
cmd.Connection = Con
DaLogin.SelectCommand = cmd
DaLogin.Fill(dtable)
Dim result As Integer
result = dtable.Rows.Count
If result > 0 Then
MsgBox("User found now open the conenction", "Valid User", vbOKOnly + vbInformation)
btnconnect.Enabled = True
Else
MsgBox("User not registered in database. try again or create a new account", "Invalid Phone No", vbOKOnly + vbCritical)
txtloginuser.Text = Focused()
End If