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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么提示vb 實時錯誤‘91’對象變量或 With 塊變量沒有設置?

為什么提示vb 實時錯誤‘91’對象變量或 With 塊變量沒有設置?

忽然笑 2023-04-20 19:15:10
Public Function viewData(ByVal txtSQL As String, dataGridAll As DataGrid) As IntegerDim rstData As ADODB.RecordsetDim result As String'檢索需要的信息result = ExecuteSQL(txtSQL, rstData, False)'設置datagrid的數(shù)據(jù)源If rstData.RecordCount <> 0 ThenSet dataGridAll.DataSource = rstDataviewData = rstData.RecordCountElseMsgBox "還沒有數(shù)據(jù)!", vbOKOnly + vbExclamation, "警告"viewData = 0End IfEnd Function數(shù)據(jù)庫采用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貢獻1811條經(jīng)驗 獲得超5個贊

ExecuteSQL 這個函數(shù)貼出來,估計是數(shù)據(jù)庫沒鏈接上

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
'設置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ù)庫鏈接失敗"
end if
End Function

查看完整回答
反對 回復 2023-04-23
  • 1 回答
  • 0 關注
  • 324 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號