Click to See Complete Forum and Search --> : MSHFlexGrid with ADO Recordsets = A problem for me


nlko80
September 30th, 2001, 04:49 PM
Ok, what I'm trying to do is bind a MSHFlexgrid control to an ADO Recordset. Everythings fine, the connection is there...but why does it only return one row from the recordset object when there are many rows????
Is there a property i need to set in the Flexgrid control??

Heres my sample code


Private Sub Command1_Click()
Dim db As ADODB.Connection
Dim c As ADODB.Command
Dim rs As ADODB.Recordset



Set db = New ADODB.Connection
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Downloads\Project\Database\HOFAS.mdb;Persist Security Info=False"
db.Open

Set c = New ADODB.Command
c.ActiveConnection = db
c.CommandType = adCmdText
c.CommandText = "Select * from Guest"

Set rs = New ADODB.Recordset
Set rs = c.Execute


Set MSHFlexGrid1.DataSource = rs
-------------------------------------------------

To sum it all up....the Guest table has many records, but only one record is displayed in the MSHFlexGrid...

MKSa
September 30th, 2001, 11:04 PM
The recordset you create by executing the Sql statement is readonly, forward-type cursor recordset. you can replace the code lines involving the Command object by the following:set rs = new ADODB.Recordset
rs.Open "select * from Guest", db, adOpenStatic, adLockOptimistic, adCmdText


and you should see the grid populated.