注册 登录
编程论坛 SQL Server论坛

利用VB和sql编写企业员工管理系统,但是再利用datacombo1查询时datagrid无法显示查询内容

不愿将就 发布于 2016-06-24 18:06, 2565 次点击
Dim ind As Integer
Private Sub Command1_Click()
 Select Case ind
  Case 0
       Adodc1.RecordSource = " select * from pay"
  Case 1
       Adodc1.RecordSource = " select * from pay where" & " 工作证号 =  ' " & DataCombo1.Text & " '"
 End Select
 Adodc1.Refresh
 Set DataGrid1.DataSource = Adodc1
 DataGrid1.Refresh
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
 ind = 0
 Option1(0).Value = True
End Sub

Private Sub Option1_Click(Index As Integer)
ind = Index
DataCombo1.Text = " "
Select Case Index
    Case 0
    Case 1
         Adodc2.RecordSource = "select 工作证号 from pay"
         Adodc2.Refresh
         DataCombo1.ListField = "工作证号"
    End Select

End Sub
只有本站会员才能查看附件,请 登录
1 回复
#2
mywisdom882016-06-25 10:44
Adodc1.RecordSource = " select * from pay where" & " 工作证号 =  ' " & DataCombo1.Text & " '"
你直接用字符,看看能不能查询出来,不要用变量
如果能查询出来,就是你Combo1的问题,如果不能查出来,就是你语句的问题,或者你数据库的问题
1