1 回答

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超5個(gè)贊
ExecuteSQL 這個(gè)函數(shù)貼出來,估計(jì)是數(shù)據(jù)庫(kù)沒鏈接上
Public Function viewData(ByVal txtSQL As String, dataGridAll As DataGrid) As Integer
Dim rstData As ADODB.Recordset
Dim result As String
'檢索需要的信息
result = ExecuteSQL(txtSQL, rstData, False)
if result=true then
'設(shè)置datagrid的數(shù)據(jù)源
If rstData.RecordCount <> 0 Then
Set dataGridAll.DataSource = rstData
viewData = rstData.RecordCount
Else
MsgBox "還沒有數(shù)據(jù)!", vbOKOnly + vbExclamation, "警告"
viewData = 0
End If
else
msgbox "數(shù)據(jù)庫(kù)鏈接失敗"
end if
End Function
添加回答
舉報(bào)