Dim cmd As New SqlClient.SqlCommand Dim DaLogin As New SqlClient.SqlDataAdapter Dim ds As New DataSet cmd.CommandText = "SELECT PhoneNo from [Users] WHERE PhoneNo = '" & Convert.ToInt64(txtloginuser.Text.Trim) & "'" Con.Open() cmd.Connection = Con DaLogin.SelectCommand = cmd DaLogin.Fill(ds, "0") Dim count = ds.Tables(0).Rows.Count 'check weither data exist in database or not If count > 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
Dim query As String = "SELECT PhoneNo from [Users] WHERE PhoneNo = @LoginUser" Using conn As New System.Data.SqlClient.SqlConnection("Connection String") Dim cmd As New System.Data.SqlClient.SqlCommand(query, conn) cmd.Parameters.AddWithValue("@LoginUser", SqlDbType.NVarChar).Value = txtloginuser.Text conn.Open() cmd.ExecuteNonQuery()
cmd.CommandText = "SELECT PhoneNo from [Users] WHERE PhoneNo = '" txtloginuser.Text.Trim & "'"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)