用代码:
ado1.ConnectionString = cnHhsoft
ado1.RecordSource = "select * from 表 where 字段1= '在职职工'"
ado1.Refresh你的记录是在TextBox里显示的吗?
ado1.ConnectionString = cnHhsoft
ado1.RecordSource = "select * from 表 where 字段1= '在职职工'"
ado1.Refresh你的记录是在TextBox里显示的吗?
比较方便的做法是将Option做成一个数组:
1 在option1的属性窗口index项中输入0;
2 把option2改名为option1,index设置为1;
3 把option3改名为option1,index设置为2。
添加下列代码:dim tblname(2) as stringprivate sub form1_load()
tblname(0) = "在职"
tblname(1) = "退休"
tblname(2) = "病退"
end subprivate sub option1_click(byval Index as integer)
ADO1.RecordSourece=tblname(Index)
ADO1.refresh
end sub
Private Sub Option1_Click()
ado1.RecordSource = "在职库"
ado1.Refresh
Text1(0).DataSource = "ado1"
Text1(0).DataField = "ID"
End Sub
Private Sub Option2_Click()
ado1.RecordSource = "退休库"
Text1(1).DataSource = "tuixiu"
Text1(2).DataField = "ID"
tuixiu.Refresh
End Sub
2.改变记录源时,注意要绑定的记录字段是否存在