hi every 1 i am trying to copy stored Employee id and i want to show it on a customer registration form. Basically i want to show which employee severd which customer. below is my code could you plz check or modify it thanks
Dim Con As New SqlConnection
Dim cmd As New SqlCommand
Try
Con.ConnectionString = ("Data Source=SAAD-PC\SQLEXPRESS;Initial Catalog=photoshoot;Integrated Security=True")
Con.Open()
cmd.Connection = con
cmd.CommandText = "SELECT Emp_id FROM staff Where UserName" = "'& login.txtUserName.Text& '"
Dim lrd As SqlDataReader = cmd.ExecuteReader()
RegisterCustomer.txtEmpIDReg.Text = Convert.ToString(lrd("Emp_id"))
Catch ex As Exception
MessageBox.Show("Error while retrieving records on table..." & ex.Message, "Load Records")
Finally
Con.Close()
End Try
Me.Hide()
RegisterCustomer.Show()
RegisterCustomer.txtServerBy.Text = login.txtUserName.Text
End Sub