VB.NET指定的选择查询OLEDB数据库



请帮助,我试图在select,werth,where子句上显示在datagridview上的指定数据:

Private Sub showdata()
    Dim identity As String = frmmgrusers.hdtxtid.Text
    Dim dbcommand As String
    dbcommand = "SELECT First_Name, Second_Name, Dob, ID_Card_No, Email, Username, [Password] FROM UsersTB WHERE ID='" & identity & "'"
    adt = New OleDbDataAdapter(dbcommand, dbconn)
    datatable = New DataTable
    adt.Fill(datatable)
    dgvusersreporting.DataSource = datatable
End Sub

但什么也没有显示,此showdata()sub写在表单加载上时,当用户单击其他表单的按钮时,它将显示带有datagridview的表单显示带有ID的指定数据。我试图删除Where子句:

dbCommand ="选择first_name,second_name,dob,id_card_no,emair,emair,用户名,[密码] userstb"

它显示了数据(怪异...?),但是我只需要带有ID

的指定数据

我不敢相信它实际上是有效的...通过此查询" select first_name,second_name,dob,id_card_no,emair,emair,username,username,[password]来自userstb,where id ="&身份&"虽然不了解id ='的区别是什么,"&身份&"'to ID =" $ IDENTITY $"

最新更新