Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB-Oracle - MoveFirst does not work

Status
Not open for further replies.

Dzidze

Programmer
Aug 10, 2001
49
CA
Hi to all.
Here are the facts:

I have 3 variables declared as Global Objects in a module:
OraSession
OraDatabase
OraRecordset

Here is the code:

Private Sub LoadGrid()
Dim sSQL As String
Dim sData As String

Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.dbOpenDatabase("Service", "user/tpassword", 0&)
sSQL = "SELECT * FROM tbldba"
Set OraRecordset = OraDatabase.CreateDynaset(sSQL, 8&)

If OraRecordset.RecordCount = 0 Then
Me.MSFlexGrid.Clear
Else
OraRecordset.MoveFirst
Me.MSFlexGrid.Rows = 1
Do Until OraRecordset.EOF = True
sData = "" & Chr$(9)
sData = sData & OraRecordset.Fields(0) & Chr$(9)
sData = sData & OraRecordset.Fields(1) & Chr$(9)
sData = sData & OraRecordset.Fields(2) & Chr$(9)
sData = sData & OraRecordset.Fields(3) & Chr$(9)
Me.MSFlexGrid.AddItem sData
OraRecordset.MoveNext
Loop
End If
End Sub

Now the problem:
The connection works fine. But the grid displays only the last entry made in the table tbldba. The problem is the MoveFirst event, because the RecordCount works fine.

Is this a bug? Or do I have to write more code in order to see all my entries in the grid?

Any help will be appreciated.

Thanks ''Life is like a box of chocolate...''
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top