Home > Software engineering >  Program is running the popup object variables or with variable is not set wrong
Program is running the popup object variables or with variable is not set wrong

Time:10-19

Public Sub intTreeData ()
Dim objNode As Node
Dim objRecordset As ADODB. You
Dim objSubRecordset As ADODB. You
Dim strSQL As String
Dim strClass As String

TreeView1. Nodes. The Clear

'according to the root node
StrClass="arrester online monitoring"
TreeView1. Graphics.linestyle=tvwRootLines
'
query lineStrSQL="select distinct lines from parameter table order by line"
The Set objRecordset=the ExecuteSQL (strSQL)
'
query parametersStrSQL="select distinct lines, parameters from table order by circuit, parameters"
The Set objSubRecordset=the ExecuteSQL (strSQL)

objRecordset. MoveFirst here object variables or with variable is not set
'the parameter information added to the TreeView control
Do Until objRecordset. EOF
ObjSubRecordset. MoveFirst
The Set objNode=TreeView1. Nodes. The Add (,, strClass, objRecordset. Fields (0))

The Do While Not objSubRecordset. EOF
If objSubRecordset. Fields (0)=objRecordset. Fields (0) Then
The Set objNode=TreeView1. Nodes. The Add (strClass tvwChild,, _
ObjSubRecordset. Fields (1))
End the If
ObjSubRecordset. MoveNext
Loop

StrClass=strClass & amp; "1"
ObjRecordset. MoveNext
Loop

ObjSubRecordset. Close
ObjRecordset. Close
The Set objRecordset=Nothing
The Set objSubRecordset=Nothing
End Sub

Problems appeared in the scarlet letter which, everyone a great god

CodePudding user response:

The ExecuteSQL did not return a valid object of you, who knows the ExecuteSQL how you write,

CodePudding user response:

ObjRecordset MoveFirst 'this sentence is redundant,

In addition, to solve your problem, need to check your open the Connection object is properly, and whether the ExecuteSQL function executed correctly the object you open operation,

CodePudding user response:

Don't know if you have defined the connection object, you can define a dim cn as new ADODB library. The connection, Set the cn=new ADODB. Connection, cn. The Open ". The Provider=Microsoft Jet. The OLEDB. 4.0. Data Source="& amp; App. The Path & amp; "\ your database name. MDB. The Jet OLEDB: Database Password=; Persist Security Info=False;" , oh, refer to the project, the first, and are for reference only
  • Related