登录后 显示用户从哪个城市和国家/地区使用 vb.net



这是我的表....

 UserID     FullName   City    Country       Usr     Pswrd
 ------------------------------------------------------------
 101         MRJONE    LHR       PAK         ABC       123

在表格 1 上,我有

SQLCon = New SqlConnection(sqldata)
    SQLCon.Open()
    Dim qry As String = "select usr,pswrd from tbllogin where usr= '" & TextBox1.Text & "' and pswrd='" & TextBox11.Text & "'"
    SQLCmd = New SqlCommand(qry, SQLCon)
    SQLdr = SQLCmd.ExecuteReader
    If SQLdr.HasRows Then
        Main.Show()
    Else
        MsgBox("Invalid User")
    End If
    Me.Hide()

在 Form2 上,我有一些标签和文本框

labelFullName.text  = 
citytextbox.text = 
Countrytextbox.text = 

我怎样才能填写这些...

我解决了.....

 Public Sub GetdataName()
    Try
        SQLCon = New SqlConnection(ConStr)
        SQLCon.Open()
        SQLCmd = New SqlCommand("SELECT FullName, Contact, Designation, Division, District, Center, Permission, Usr FROM dbo.TblLogin Where Usr='" & Login.UserTextBox.Text & "'", SQLCon)
        SQLdr = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection)
        While (SQLdr.Read() = True)
            TSSLUser.Text = SQLdr(7)
            TSSLDesignation.Text = SQLdr(2)
            TSSLDivision.Text = SQLdr(3)
            TSSLDistrict.Text = SQLdr(4)
            TSSLCenter.Text = SQLdr(5)
        End While
        SQLCon.Close()
    Catch ex As Exception
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
End Sub

最新更新