|
-
Jan 16th, 2003, 10:56 AM
#1
Thread Starter
New Member
Hierarchical Flexgrid - Error 30022
Can anyone help? - I have searched MSDN and these forums, but to avail.
I am trying to populate a mshflexgrid (in VB6) with the following simple statement:
Private Sub Form_Load()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
With cn
.Provider = "SQLOLEDB"
.ConnectionString "server=xxxx;database=xxx_test;uid=xxxxx;password=pword"
.Open
End With
rs.Open "select * from Product", cn
Set MSHFlexGrid1.DataSource = rs
End Sub
The final statement, 'Set MSHFlexGrid1.DataSource = rs' produced the following error message:
Run Time Error '30022':
The Hierarchical Flexgrid does not support the requested type of data binding.
I have added the Microsoft Hierarchical Flexgrid Control 6.0 (SP4) to components and added Microsoft ActiveX Data Objects 2.7 Library to References.
That is everything there is - broken down to simplest level, yet still no joy. Can anyone help - is it a simple programming error or am I missing a component??
-
Jan 16th, 2003, 12:05 PM
#2
New Member
I tried to find this error in my MSDN , and found the following solution :
SYMPTOMS
Attempting to rebind the MSHFlexGrid to a different Data Environment as the DataSource property results in an error:
Runtime Error 30022, The Hierarchical FlexGrid does not support the requested type of data binding.
CAUSE
If the MSHFlexGrid.DataMember is set to a Data Environment other than the original, the MSHFlexGrid attempts to rebind the data using the previous DataSource property setting. Because the same Command does not exist in the subsequent Data Environment, an error results.
RESOLUTION
To work around this problem, set MSHFlexGrid.DataSource = Nothing before rebinding to the next Data Environment.
I hope it will work for you ....
mmaenb
-
Jan 17th, 2003, 04:50 AM
#3
Thread Starter
New Member
Thanks MMaenB - that didn't directly solve the problem but somehow it is fixed! Typical VB!
I tried setting the datasource to nothing, but got the same problem. I then found I had set the datasource to rs in properties and datamember to cn, so I cleared this but with the same 30022 error.
I was about to give up and go to a plain flexgrid when I ran the program again and found that it worked!!?? I dont know how or why, or if resetting the properties was the definitive answer, but I aint buggering around with it now!
Cheers MMaenB!
-
Jan 19th, 2003, 11:53 AM
#4
ianjones007,
The only thing that I saw that was that you should have used
Dim rs as ADODB.Recordset
Set rs = New ADODB.Recordset
before using the reference in the MSHFlexGrid.Datasource statement and in the design properties of MSHFlexGrid never default set the Datasource property to anything if you are going to change it on the fly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|