how to connect Crystal report with SQL Server-VBForums
Results 1 to 8 of 8

Thread: how to connect Crystal report with SQL Server

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    how to connect Crystal report with SQL Server

    hi all.


    am newbie with SQL server. how can make connection with Sql server 2005 tables with crystal report 8.0 + VB 6.0

    saj
    Last edited by sajankk; Jan 17th, 2008 at 02:17 AM.

  2. #2
    Frenzied Member
    Join Date
    Apr 2003
    Location
    The Future - Skynet
    Posts
    1,116

    Re: how to connect Crystal report with SQL server

    You create the connection through Crystal Report. There is a wizard that will link it for you.

    You use VB6 for two reasons:
    1. is to fire the report
    2. is to change the datasource(server, database) on command by using code. This is a great way to test against different environments. Changing it manually, well good luck if you have subreports.

    In addition, I recommend you to write a sp against a table rather than connecting straight to a table. Later you might need to get data from multiple tables and a sp will let you join tables.
    I'll Be Back!

    T-1000

    Microsoft .Net 2005
    Microsoft Visual Basic 6
    Prefer using API

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how to connect Crystal report with SQL server

    actualy through the crystal report wizard i connected table and i designed already. but through the code how can i fire the reports. in a click how can open the report. i did the same thing when i was using access + crystal +vb 6.0 in a desktop environment but in SQL Server i did not. am using crystal 8.0 component.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how to connect Crystal report with SQL server

    Please anybody can help me

  5. #5
    New Member
    Join Date
    Jan 2008
    Location
    Prestea, Ghana
    Posts
    3

    Unhappy Re: how to connect Crystal report with SQL server

    To connect VB6.0 to Crystal Report:
    Note:
    Set a reference to Crystal Report ActiveX Designer Runtime library(CRAXDRT)
    Save the report in the app.path

    Private Sub Form_Load()
    Dim strSQLReport
    Dim strRptName
    Dim conObj As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim CrAppl As New CRAXDRT.Application
    Dim CrRep As New CRAXDRT.Report

    strRptName = "yourReportfileName.rpt"
    strSQLReport = "SELECT * from tablename WHERE yourdate between
    ('" & DTPicker1.Value & "') AND ('" & DTPicker2.Value & "')"

    With conObj
    .ConnectionString = "Provider= sqloledb.1;" & _
    "Data source=ServerName"; initial catalog=DatabaseName;" & _
    "integrated security=SSPI;"

    .Open
    End With
    rs.Open strSQLReport, conObj, adOpenDynamic
    Set CrRep = CrAppl.OpenReport(strRptName, crOpenReportByTempCopy)
    CrRep.Database.Tables(1).SetDataSource rs, 3
    With CRViewer91
    .ReportSource = CrRep
    .ViewReport
    Set CrRep = Nothing
    Set CrAppl = Nothing
    End With
    End Sub

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how to connect Crystal report with SQL server

    when i design the report and preview the same from crystal report itself it showing an error "No rowset was returned for this table, query, or procedure". and after i click ok another message like " Error detected by Database DLL". what will be the problem.

    i am using SQL Server 2005 + Crystal 8.0 + Vb 6.0.

    saj

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how to connect Crystal report with SQL Server

    any suggestion can be appreciated

    saj

  8. #8
    Frenzied Member
    Join Date
    Apr 2003
    Location
    The Future - Skynet
    Posts
    1,116

    Re: how to connect Crystal report with SQL Server

    Were you able to get the report working connecting to SQL Server? Connect the report to SQL Server manually first.

    If you can get that part at least working, then you are in business. We can then move on to the next step.
    I'll Be Back!

    T-1000

    Microsoft .Net 2005
    Microsoft Visual Basic 6
    Prefer using API

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.