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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASAP LAST DAY (CRYSTAL HELP CONNECTION SQL)

Status
Not open for further replies.

lashwarj

IS-IT--Management
Nov 1, 2000
1,067
US
I have one day to finish this, I guess I could just leave it but I Hate to do that (new job bigger and better, lol)


Here is the code I have in my init of my report bound form,




PARAMETERS reportlocation

Thisform.WindowState = 2
oCRObject = CREATEOBJECT( "CrystalRunTime.Application" )
oReportObject = oCRObject.OpenReport(reportlocation)
Thisform.oleCRView.ReportSource = oReportObject

Thisform.oleCRView.ViewReport()
Thisform.oleCRView.ZOOM(1)
Thisform.oleCRView.DisplayGroupTree = .F.
Thisform.oleCRView.DisplayTabs = .F.
Thisform.oleCRView.EnableCloseButton = .F.
Thisform.oleCRView.EnableExportButton = .T.
Thisform.oleCRView.EnableSearchExpertButton = .T.
Thisform.oleCRView.EnableSelectExpertButton = .T.



When I go to open this it tells me can not start the server or something like that.

If I run a access bound report it works great, just when my
connection is SQL. So Question (after all that) How can I connect to an SQL Server with these parameters

USERNAME: test_user
PASSWORD: jinksycat
SERVER: JESTER_SQL
 
Look at the articles on my web site. You'll see examples of how to connect with both OLE DB and ODBC.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
i can connect, I just need to pass my password through to crystal


My new code looks like this and gives me the correct response, but when it get to the crystal portion it generates this error.



PARAMETERS reportlocation

STORE SQLCONNECT('Queensbury_Test', 'test_user', 'jinksycat') TO gnConnHandle
IF gnConnHandle <= 0
= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
ELSE
= MESSAGEBOX('Connection made', 48, 'SQL Connect Message')
= SQLDISCONNECT(gnConnHandle)
ENDIF

Thisform.WindowState = 2
oCRObject = CREATEOBJECT( &quot;CrystalRunTime.Application&quot; )
oReportObject = oCRObject.OpenReport(reportlocation)
Thisform.oleCRView.ReportSource = oReportObject

Thisform.oleCRView.ViewReport()
Thisform.oleCRView.ZOOM(1)
Thisform.oleCRView.DisplayGroupTree = .F.
Thisform.oleCRView.DisplayTabs = .F.
Thisform.oleCRView.EnableCloseButton = .F.
Thisform.oleCRView.EnableExportButton = .T.
Thisform.oleCRView.EnableSearchExpertButton = .T.
Thisform.oleCRView.EnableSelectExpertButton = .T.



 
You need a DSN first. Crystal can't use a DSN-less connection.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports&quot;
 
how do I set up the DNS info without having to redo my code to look like yours though, I have like 15 tables being used in this report from a sql database called Queensbury_Test
 
Go into the ODBC Manager in Windows Control Panel and create a DSN there. It will connect you to the database. This should make the tables available, depending on security settings.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports&quot;
 
I have that, but when I go to open the Crystal report it tells me the server is not yet connected. Even though the data runs fine.

My code has the test in it, the second code I provided. From within the app it runs great but when you try to access the crystal report it gives you the error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top