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

How to create crystal report in VB using sqlserver

Status
Not open for further replies.

RAMA1000

Programmer
Mar 6, 2003
4
0
0
US
Iam new to VB.
I have added crystal report to the vb project.
Then I added created a new report using ADO.
but When I run it, it says 'connection not opened'

How to open connection to sqlserver for running the report.?
Does each table which is used in report has to be opened?

sample code or example is appreciated

Thanks in advance
Rama
 
Thanks ..It worked!!
below is the code I put in there.

The connection in report should be ADO. I have several reports which did not use ADO.. they used odbc.. Could you help me with that.. ??

Thanks


-------------------code used to pass connection to crystal__
strconn = "Provider=SQLOLEDB.1;Persist Security Info=true;User ID=ABCD;password=ZYX;Initial Catalog=TestDATA;Data Source=HORNETsrv"
Set oconn = New ADODB.Connection
oconn.open strconn

strsql = "select * from cus_milc_county_email"


Set rscust = New ADODB.Recordset
rscust.open strsql, oconn

Set qrydata = New ADODB.Command

qrydata.CommandText = strsql

Report.Database.AddADOCommand oconn, qrydata
 
The same site has lots of connection strings for different needs:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top