CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 1999
    Location
    India
    Posts
    10

    crystal report 6 Urgent!!!!

    Hi guys
    I am working on crystal report 6. i was using ms access as backend and connecting through a DSN. Now i have changed the backend to oracle. and i have changed the DSN in the crystal report to the new DSN. In preview mode i am able to see the report. but when i am calling the report from VB it is giving me a strange error
    "Can not find SQl server"
    Can anybody solve my problem

    Thanx in advance



  2. #2
    Join Date
    Dec 1999
    Location
    Slovakia
    Posts
    26

    Re: crystal report 6 Urgent!!!!

    Of course, You need to change logon property to server at runtime. Preview inside CrystalReport using his own connect so you can see report properly. See SetLogOnInfo method of CrystalReport object to set your ORACLE logon information. See code shipet for CR70 but may be functional for CR60.

    I hope this help you.


    Dim db as CRPEAuto.Database
    Dim dbtables as CRPEAuto.DatabaseTables
    Dim dbTable as CRPEAuto.DatabaseTable
    Dim dbSection as CRPEAuto.Section
    Dim objSubReport as Object
    Dim i as Integer


    set db = objReport.Database
    set dbtables = db.Tables
    'find the alias name of the first table in the database
    If dbtables.Count >= 1 then
    set dbTable = dbtables.Item(1)
    dbTable.SetLogOnInfo "servername", "database", "sa", ""
    for i = 1 to dbtables.Count
    set dbTable = dbtables.Item(i)
    dbTable.Location = dbTable.Name
    next
    End If




    don't forget do it for subreports if exist




    [ufo]

  3. #3
    Guest

    Re: crystal report 6 Urgent!!!!

    At design time, you would have logged into the Oracle Server when launching the report. When connecting from VB, you would have to specify the connect string in the connect property of the Crystal Report Control or before invoking the
    Action method in the VB Code,
    set the connect string, Your code should be something like this:


    CRep1.Connect = "UID=scott;PWD=Tiger;DSN=TestDB"
    CRep1.Action = 1



    Replace Scott/Tiger and Test DB with the respective Oracle User Id/Password and DSN Name.

    Happy New Millineum



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

Featured