Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Load Records From ADO Recordset
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Load Records From ADO Recordset

 Post Reply Post Reply
Author
Message
DueSoft View Drop Down
Newbie
Newbie
Avatar

Joined: 08 July 2006
Location: Indonesia
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote DueSoft Quote  Post ReplyReply Direct Link To This Post Topic: Load Records From ADO Recordset
    Posted: 08 July 2006 at 12:50am
Hi...

Please help me...

How to adding records item from ado recordset?

Thank's B4.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2006 at 8:49am
Hi,

This should be done via your code:
-- open a recordset;
-- iterate all records;
-- for every of them, create a corresponding ReportRecord object;
-- for every field of the record, add a corresponding ReportRecordItem object to the ReportRecord (for corresponding columns).
-- call ReportControl.Populate

--
WBR,
Serge
Back to Top
DueSoft View Drop Down
Newbie
Newbie
Avatar

Joined: 08 July 2006
Location: Indonesia
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote DueSoft Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2006 at 11:41pm
Thank's B4,

I'm is new use this control, can you help me.
please tell me way to write it's code?

Thank's
Back to Top
OscarM View Drop Down
Groupie
Groupie
Avatar

Joined: 07 November 2005
Status: Offline
Points: 72
Post Options Post Options   Thanks (0) Thanks(0)   Quote OscarM Quote  Post ReplyReply Direct Link To This Post Posted: 10 July 2006 at 3:02am
  Dim pCol As ReportColumn
  Dim pRecord As ReportRecord, pItem As ReportRecordItem
  Dim pField As ADODB.Field
  Dim i As Long
 
  For Each pField In Rs.Fields
    With Rp1
      Set pCol = .Columns.Add(i, pField.Name, 100, True)
      Select Case pField.Type
        Case adBigInt, adDecimal, adDouble, adInteger, adNumeric, adSingle, adSmallInt, adTinyInt
          'todo
        Case adBoolean
          'todo
        Case adDate, adDBDate, adDBTime, adDBTimeStamp
          'todo
      End Select
    End With
  Next
 
  Do Until Rs.EOF
    Set pRecord = Rp1.Records.Add
    For Each pField In Rs.Fields
      If pField.Type = adBoolean Then
        Set pItem = pRecord.AddItem("")
        pItem.HasCheckbox = True
        pItem.Checked = pField.Value = True
      Else
        Set pItem = pRecord.AddItem(pField.Value)
      End If
    Next
    Rs.MoveNext
  Loop
 
  Rp1.Populate
 
  Set pCol = Nothing
  Set pField = Nothing
  Set pRecord = Nothing
  Set pItem = Nothing
Back to Top
DueSoft View Drop Down
Newbie
Newbie
Avatar

Joined: 08 July 2006
Location: Indonesia
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote DueSoft Quote  Post ReplyReply Direct Link To This Post Posted: 10 July 2006 at 10:32pm


It's Great!

But sorry, i'm done understand about this code,
'-------------------------------------------
      Select Case pField.Type
        Case adBigInt, adDecimal, adDouble, adInteger, adNumeric, adSingle, adSmallInt, adTinyInt
          'todo
        Case adBoolean
          'todo
        Case adDate, adDBDate, adDBTime, adDBTimeStamp
          'todo
      End Select
'------------------------------------------------------
When i try this code, i have a problem,
For example :
I have data like this :
----------------------------------
|No   |Name        |Phone      |
----------------------------------
|1    |Boy          |123456    |
|2    |David        |25633     |
----------------------------------

when i try, the result is like this :
----------------------------------
|No   |Name        |Phone      |
----------------------------------
|1    |1            |1        |
|1    |1            |1        |
----------------------------------

Why???? and what i do in code 'todo', please help me....
Can you send me fully code or VB Project for this code?


Thank's
Best Regards.
Back to Top
Timothy5 View Drop Down
Newbie
Newbie


Joined: 03 March 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Timothy5 Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2007 at 8:47pm
I have a similar issue when I use columns that meet the Case conditions. What is the solution?
Back to Top
Timothy5 View Drop Down
Newbie
Newbie


Joined: 03 March 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Timothy5 Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2007 at 9:04pm

Added i = i + 1 just after the case statement to correct the issue.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.