-
Jan 7th, 2008, 06:47 AM
#1
Thread Starter
Hyperactive Member
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.
-
Jan 8th, 2008, 10:20 PM
#2
Frenzied Member
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
-
Jan 9th, 2008, 06:44 AM
#3
Thread Starter
Hyperactive Member
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.
-
Jan 12th, 2008, 03:09 AM
#4
Thread Starter
Hyperactive Member
Re: how to connect Crystal report with SQL server
Please anybody can help me
-
Jan 14th, 2008, 03:18 AM
#5
New Member
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
-
Jan 17th, 2008, 01:07 AM
#6
Thread Starter
Hyperactive Member
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
-
Jan 20th, 2008, 12:55 AM
#7
Thread Starter
Hyperactive Member
Re: how to connect Crystal report with SQL Server
any suggestion can be appreciated
saj
-
Jan 26th, 2008, 05:32 PM
#8
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|