Connection String with Crystal

P

pooba53

Posted this to vb.crystal and received no response.
----------------------------------------------------------------------------
I'm using VS 2003 and VB .NET along with the embedded version of
Crystal Reports. When I build and deploy my application, the Access db
that I use is stored in the directory containing the executable that
launches my program.

So that my application knows to find the access db in the same
directory as the executable when I ship the application, I use the
following in my connection string:
AppBase = AppDomain.CurrentDomain.BaseDirectory & "data.mdb"

Then I do this:

' Update our connection string
Me.OleDbConnection2.ConnectionString = "Jet OLEDB:Global
Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=" & AppBase & ";Jet OLEDB:Engine
Type=5;Provider=""Mic" & _
"rosoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist sec" & _
"urity info=False;Extended Properties=;Mode=Share Deny
None;Jet OLEDB:Encrypt Dat" & _
"abase=False;Jet OLEDB:Create System Database=False;Jet
OLEDB:Don't Copy Locale o" & _
"n Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;User ID=Admin;Jet" & _
" OLEDB:Global Bulk Transactions=1"

This works fine for my application...no problems.

However, I need to do the same for Crystal Reports so that it too
knows of the db location in a deployed application.

I cannot find in my code where the CR connection string is so I can
modify it in my code. How do I accomplish a modification of the CR db
connection string (at runtime?)?

Thanks a ton!
-Dan
 
J

jayeldee

Posted this to vb.crystal and received no response.
---------------------------------------------------------------------------­-
I'm using VS 2003 and VB .NET along with the embedded version of
Crystal Reports. When I build and deploy my application, the Access db
that I use is stored in the directory containing the executable that
launches my program.

So that my application knows to find the access db in the same
directory as the executable when I ship the application, I use the
following in my connection string:
AppBase = AppDomain.CurrentDomain.BaseDirectory & "data.mdb"

Then I do this:

' Update our connection string
Me.OleDbConnection2.ConnectionString = "Jet OLEDB:Global
Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=" & AppBase & ";Jet OLEDB:Engine
Type=5;Provider=""Mic" & _
"rosoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist sec" & _
"urity info=False;Extended Properties=;Mode=Share Deny
None;Jet OLEDB:Encrypt Dat" & _
"abase=False;Jet OLEDB:Create System Database=False;Jet
OLEDB:Don't Copy Locale o" & _
"n Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;User ID=Admin;Jet" & _
" OLEDB:Global Bulk Transactions=1"

This works fine for my application...no problems.

However, I need to do the same for Crystal Reports so that it too
knows of the db location in a deployed application.

I cannot find in my code where the CR connection string is so I can
modify it in my code. How do I accomplish a modification of the CR db
connection string (at runtime?)?

Thanks a ton!
-Dan

http://www.codeproject.com/useritems/CrystalWin.asp
This does what you're looking for but it's in C#. Should be easy
enough to get it over to VB.NET. I've used it in my own code and it
works well.
 
P

pooba53

Looks like this snippet from the Business Objects Web site did the
trick:

dbPath = AppDomain.CurrentDomain.BaseDirectory & "data.mdb"

Dim MyReport As New CrystalReport1
Dim CrTables As Tables
Dim CrTable As Table

CrTables = MyReport.Database.Tables

For Each CrTable In CrTables
CrTable.Location = dbPath
Next

Everything is now groovy.

Hope this helps someone...
 
J

jayeldee

Looks like this snippet from the Business Objects Web site did the
trick:

dbPath = AppDomain.CurrentDomain.BaseDirectory & "data.mdb"

Dim MyReport As New CrystalReport1
Dim CrTables As Tables
Dim CrTable As Table

CrTables = MyReport.Database.Tables

For Each CrTable In CrTables
CrTable.Location = dbPath
Next

Everything is now groovy.

Hope this helps someone...










- Show quoted text -

Sorry. That c# code used the LogonInfo object for a SQL connection,
not an access one which you'd requested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top