假设我的第一列是“编号”,我搜索按编号。
Private Sub DataGrid1_Click()
DataGrid1.Col = 0
Text2.Text = DataGrid1.Text
rs.Open "SELECT* FROM zgdagl WHERE 编号='" & Text2.Text & "'", conn, adOpenStatic, adLockOptimistic
Text2.Text = rs!编号
Text3.Text = rs!姓名
Text4.Text = rs!性别
Text5.Text = rs!出生年月
Text6.Text = rs!是否党员
Text7.Text = rs!基本工资
Text8.Text = rs!奖金
bianhao = Text2.Text
rs.Close
End Sub
就这样搞定