dim i as string Call Cn1close Call Rs11close Rs11.CursorLocation = adUseClient Cn1.Open "Driver={SQL Server};Server=SERVER;Database=SERVER;Uid=sa;Pwd=;" Rs11.Open "select * from server where (数据库中的字段)like '%" & i & "%' Order by strSQL_Query ", Cn1, adOpenStatic, adLockOptimistic If Rs11.RecordCount > 0 Then Set DataGrid1.DataSource = Rs11 Else MsgBox "没有满足条件的歌曲", vbInformation + vbOKOnly, "提示" Exit Sub End If End If
你这是窗口调用,返回的问题,在调用的窗体中new你要show的窗体, 在show的窗体中定义一个事件,用来返回你查询出的记录集..注意,在主窗体中级中声明时应该如下:private WithEvents frm as frm查询许可证 在cmdQuery_Click事件中写上:Private Sub cmdQuery_Click() Dim frm As New frm查询许可证 frm.Show End Sub
你这是窗口调用,返回的问题,在调用的窗体中new你要show的窗体, 在show的窗体中定义一个事件,用来返回你查询出的记录集..注意,在主窗体中级中声明时应该如下:private WithEvents frm as frm查询许可证 在cmdQuery_Click事件中写上:Private Sub cmdQuery_Click() if frm is nothing then set frm= New frm查询许可证 end if frm.show End Sub在子窗体中定义一个事件: public Events BackRecord(byval rs as AdoDB.Recordset)然后在主窗体的frm_BackRecord事件中处理传来的rs
http://www.codeclub.net/bbs/
Call Cn1close
Call Rs11close
Rs11.CursorLocation = adUseClient
Cn1.Open "Driver={SQL Server};Server=SERVER;Database=SERVER;Uid=sa;Pwd=;"
Rs11.Open "select * from server where (数据库中的字段)like '%" & i & "%' Order by strSQL_Query ", Cn1, adOpenStatic, adLockOptimistic
If Rs11.RecordCount > 0 Then
Set DataGrid1.DataSource = Rs11
Else
MsgBox "没有满足条件的歌曲", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
End If
在show的窗体中定义一个事件,用来返回你查询出的记录集..注意,在主窗体中级中声明时应该如下:private WithEvents frm as frm查询许可证
在cmdQuery_Click事件中写上:Private Sub cmdQuery_Click()
Dim frm As New frm查询许可证
frm.Show
End Sub
在show的窗体中定义一个事件,用来返回你查询出的记录集..注意,在主窗体中级中声明时应该如下:private WithEvents frm as frm查询许可证
在cmdQuery_Click事件中写上:Private Sub cmdQuery_Click()
if frm is nothing then
set frm= New frm查询许可证
end if
frm.show
End Sub在子窗体中定义一个事件:
public Events BackRecord(byval rs as AdoDB.Recordset)然后在主窗体的frm_BackRecord事件中处理传来的rs