hello,
why to make the query so complex dear just have 2 textbox and you are done
hers your code but i still don't get it why you want the password to appear on textbox2 as it may harm the applications security anyways her's your code also you wana set the textbox2 mode to password so whats the use
Explanation: I have not used datagrid as this can be done without datagrid and please encrypt your password and then save them to database
Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As SqlConnection = New SqlConnection("Data Source=.;Initial Catalog=master;Integrated Security=True")
con.Open()
Dim query As String = "select pass from mytable where user1='" + TextBox1.Text + "'"
Dim cmd As SqlCommand = New SqlCommand(query, con)
Dim da As SqlDataReader = cmd.ExecuteReader()
If (da.Read() = True) Then
TextBox2.Text = da(0).ToString()
TextBox2.UseSystemPasswordChar = True
Else
MessageBox.Show("Database scan complete no such user found")
End If
con.Close()
con.Dispose()
End Sub
End Class
Do rate my answer once you find it useful
Thanks & Regards
Radix :)