SQL Server Performance

SQL2000, Crystal Report 9, VB 6

Discussion in 'General Developer Questions' started by tdong, Mar 10, 2004.

  1. tdong New Member

    Hi Guys

    Does anyone know how to use crystal report in VB6? I know this is not the right forum to ask but I only use this forum ever since.

    in my vb references
    -Crystal Reports 9 ActiveX Designer Design and Runtime Library
    in components
    -Crystal Report Viewer Control 9
    -Crystal Report Select Expert 9

    Here is what I have Crystal Report 9, I create a crystalreport to my SQL2000 database everything is working fine then I save it. Open Visual Basic add Active CrystalReport Designer and open the Report that I created. on my vb program I created a button to view the report. Then I run it it is working fine but when I compiled I can't view it anymore and have the following error messages. The problem is I can't create a connection to the database when I compile the code. Any idea?. When I use crystal report there is a log on or off from the file menu I can't seem to be able to control that with VB.

    Details: ADO Error Code: 0x80040e4d
    Source:Microsoft OLE DB Provider for SQL Server
    Description: Login failed for user 'sa'
    SQL State: 42000
    Native Error:18456

    Thanks alot I have been searching the web like two days and no luck yet

    May the best cheaters win
  2. satya Moderator

    For the appropriate forum refer to thishttp://www.tek-tips.com/ link for crystal reports.

    For that 18456 error check your security settings in SQL, this usually happen when you are using windows authentication.

    Satya SKJ
    This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
  3. tdong New Member

    I have a solution after searching and searching.

    There are two way of creating CR 9 and VB 9
    1- is to create the CR9 viewer with CR9 and remember to check integrated when entering database info
    then when you add activex designer open existing one.

    2- create the viewer(activex designer) using dll or ocx in VB 6. this line below is not require if you using the database expert wizard.
    -------Report.Database.LogOnServer "P2ssql.dll", "servername", "database", "sa", "password"

    you need to add this line for every single table you need. item(1) can be item("tablename")
    -------Report.Database.Tables.Item(1).ConnectionProperties.Item("password") = "password"

    sample codes :
    CRViewer91 is the view you design

    'VB 6 form
    Dim Report As New CrystalReport1

    Private Sub Form_Load()
    Screen.MousePointer = vbHourglass
    'Report.Database.LogOnServer "P2ssql.dll", "servername", "database", "sa", "password" <---not required
    Report.Database.Tables.Item(1).ConnectionProperties.Item("password") = "password"

    CRViewer91.ReportSource = Report
    Screen.MousePointer = vbDefault

    End Sub

    Private Sub Form_Resize()
    CRViewer91.Top = 0
    CRViewer91.Left = 0
    CRViewer91.Height = ScaleHeight
    CRViewer91.Width = ScaleWidth

    End Sub

    May the best cheaters win
  4. backborn New Member

    [FONT=宋体]Try to use the tool at [/FONT][FONT=宋体]http://www.raqsoft.com/[/FONT][FONT=宋体][/FONT]
    [FONT=宋体]You can get it for free,I think it can help you solve your problem.I hope I can help you.
  5. Madhivanan Moderator

    [quote user="backborn"]
    Try to use the tool at http://www.raqsoft.com/
    You can get it for free,I think it can help you solve your problem.I hope I can help you.

    Why are you always suggesting to use this tool?
    Can you show an example to find pagewise total in raqsoft tool? [;)]
  6. backborn New Member

    what does "pagewise" mean?In fact,RAQ Report is more excellent than Crystal Report.I suggest to use it becasue of its advantages,such as cross-platform,pure-java reporting tool.I think it can help you.What's more ,you can get it for free,Why don't you try?

Share This Page