Results 1 to 7 of 7

Thread: VB DataReport

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    VB DataReport

    I have a wierd question, I have some reports that are generated based on input written in textboxes on a form....NOT from a database anywhere. Also, I need to run this on a windows 95 computer, that cannot run ADO. Is there a way to get the DataReport to display the data, without having to connect to a database? The way I have done this in the past, is to connect to a test MySQL database, that only has 1 record (for time...). After I connect to that test MySQL database, I can simply fill in the labels on the form with the following:
    VB Code:
    1. Me.Sections("Section1").Controls.Item("lblPartNumber").Caption = frmTyco32.txtPartNumber.Text & ""
    2.     Me.Sections("Section1").Controls.Item("lblPartRevision").Caption = frmTyco32.txtPartRevision.Text & ""
    3.     Me.Sections("Section1").Controls.Item("lblQuantity").Caption = frmTyco32.txtQuantity.Text & ""
    4.     Me.Sections("Section1").Controls.Item("lblLabelNumber").Caption = frmTyco32.intLabelCount & ""

    I read to get ADO working on a windows 95 system, you had to install a DCOM patch...I've installed this DCOM patch, received no errors while installing...but when I run a report (that I know works on other systems), it gives me an error dealing with the ADO connections.
    Code:
    If LostAngel.Tag = "Programming" then
       LostAngel.Caption = "Awake"
    Else
       LostAngel.Caption = "Dreaming of Code"
    End If

  2. #2
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: VB DataReport

    can you post the error number as well as the description
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  3. #3
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: VB DataReport

    Hi,

    Also post the code for connecting to your MYSql database....


    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    Re: VB DataReport

    Code for this label:

    VB Code:
    1. Option Explicit
    2. Private strsql As String    'SQL String.
    3. Private cnMySQL As New ADODB.Connection   'New ADODB Connection.
    4. Private oRS As New ADODB.Recordset  'New ADODB Recordset
    5.  
    6. Private Sub DataReport_Initialize()
    7. Set cnMySQL = New ADODB.Connection 'We've declared it as an ADODB connection lets set it.
    8.     cnMySQL.CursorLocation = adUseClient 'We are Client.
    9.     cnMySQL.ConnectionString = "Provider=MSDASQL; DRIVER={MySQL ODBC 3.51 Driver}; SERVER=192.168.50.4; DATABASE=DBName; UID = Username; PASSWORD=Password; OPTION=3"  'Connection String.
    10.     cnMySQL.Open 'Opens Connection
    11.  
    12. strsql = "SELECT ID FROM tblTest "
    13.     'Connecting...
    14.     If oRS.State = adStateOpen Then oRS.Close
    15.     oRS.Open strsql, cnMySQL, adOpenForwardOnly
    16. 'Connection made.
    17. Set Me.DataSource = oRS
    18.     Me.Sections("Section1").Controls.Item("lblPartNumber").Caption = frmFloor35.txtPartNumber.Text & ""
    19.     Me.Sections("Section1").Controls.Item("lblPartRevision").Caption = frmFloor35.txtPartRevision.Text & ""
    20.     Me.Sections("Section1").Controls.Item("lblOptionalInfo").Caption = frmFloor35.txtOptionalInfo.Text & ""
    21.     Me.Sections("Section1").Controls.Item("lblQuantity").Caption = frmFloor35.txtQuantity.Text & ""
    22.     Me.Sections("Section1").Controls.Item("lblTraceNumber").Caption = frmFloor35.intLabelCount & ""
    23. End Sub

    The error I am getting is:

    Num: 3706
    Desc: Provider cannot be found. It may not be properly installed.
    Code:
    If LostAngel.Tag = "Programming" then
       LostAngel.Caption = "Awake"
    Else
       LostAngel.Caption = "Dreaming of Code"
    End If

  5. #5
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: VB DataReport

    so the error occurs with the cnMySQL.Open code right
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  6. #6
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: VB DataReport

    try to check if this provider is available on your machine. You can check this using a UDL file.

    To create a UDL file follow these steps

    1. Create a text file on desktop. and rename it as filename.UDL

    2. Now doubleclick and open it. Datalink properties dialog will open, Check for MSDASQL provider from the provider list.
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    Re: VB DataReport

    When I ran that test, and opened the .UDL file...it gave an error saying it couldnt start: OLEDB32. I've tried manually installing and registering that .dll..and the same error comes up. I know that the MySQL connections exist...as I tried to install them today and it said I already had them installed.
    Code:
    If LostAngel.Tag = "Programming" then
       LostAngel.Caption = "Awake"
    Else
       LostAngel.Caption = "Dreaming of Code"
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width