Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to connect database ?

Status
Not open for further replies.

takume

Programmer
Mar 15, 2004
9
HK
Hi all i am writing VB6 with Crystal 9. How can i write code in VB6 that request Crystal connect to the database SQL server) to get data ?? Please help thanks ?

By the way, any ebook reference guide ?
 
This is all documented in the help files distributed with crystal reports, CrystalDevHelp.chm default location is C:\Program Files\Crystal Decisions\Crystal Reports 9\Developer Files\Help\En

You can also download samples from the Business Objects web site.

HTH

Gary Parker
Systems Support Analyst
Manchester, England
 
The below code is the Form1 load default form when you add the active x. I am using ADO to connect to SQL2000 you have to pass the password inorder for it to work.

Private Sub Form_Load()
Dim tmp, tmp1 As Integer
tmp = 348
tmp1 = 350
Screen.MousePointer = vbHourglass

'Crystal Report Creating in VB 6
'Report.Database.LogOnServer "P2ssql.dll", "NSSVR2", "Database", "username", "password"
'passing password
Report.Database.Tables.Item(1).ConnectionProperties.Item("password") = "password"
'passing record selection parameters
Report.RecordSelectionFormula = "{vwCPIssuesLiquidityReport.cp_id} >=" & tmp & " and {vwCPIssuesLiquidityReport.cp_id} <=" & tmp1 & " "


CRViewer91.ReportSource = Report
CRViewer91.ViewReport
Screen.MousePointer = vbDefault

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top