第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

為什么提示vb 實(shí)時(shí)錯(cuò)誤‘91’對(duì)象變量或 With 塊變量沒有設(shè)置?

為什么提示vb 實(shí)時(shí)錯(cuò)誤‘91’對(duì)象變量或 With 塊變量沒有設(shè)置?

Public Function viewData(ByVal txtSQL As String, dataGridAll As DataGrid) As IntegerDim rstData As ADODB.RecordsetDim result As String'檢索需要的信息result = ExecuteSQL(txtSQL, rstData, False)'設(shè)置datagrid的數(shù)據(jù)源If rstData.RecordCount <> 0 ThenSet dataGridAll.DataSource = rstDataviewData = rstData.RecordCountElseMsgBox "還沒有數(shù)據(jù)!", vbOKOnly + vbExclamation, "警告"viewData = 0End IfEnd Function數(shù)據(jù)庫(kù)采用sql2000'函數(shù)名:ExecuteSQL'說 明:執(zhí)行SQL語句'參 數(shù):SQL As String, rst As ADODB.Recordset, Optional enableWrite As Boolean'返回值:SQL語句執(zhí)行成功——true,失敗——false' ******************************************************************************Public Function ExecuteSQL(ByVal SQL As String, rst As ADODB.Recordset, _Optional enableWrite As Boolean = True) As BooleanDim con As New ADODB.ConnectionDim sTokens() As StringOn Error GoTo Execute_ErrorsTokens = Split(SQL)Set con = New ADODB.Connectioncon.Open ConnectStringSet rst = New ADODB.RecordsetIf enableWrite Thenrst.Open Trim$(SQL), con, adOpenStatic, adLockOptimisticElserst.Open Trim$(SQL), con, adOpenStatic, adLockReadOnlyEnd IfExecuteSQL = TrueExit FunctionExecute_Error:ExecuteSQL = FalseExit FunctionEnd Function
查看完整描述

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

查看完整回答
反對(duì) 回復(fù) 2023-04-23
  • 1 回答
  • 0 關(guān)注
  • 297 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)