|
-
Aug 1st, 2005, 11:59 AM
#1
Thread Starter
Lively Member
Problem with Database location?
Hi guys,
Please help me with this..it looks like a simple matter, but i can't find a cure for it..
ok, let'see..
1. on my program's crystal report, I added my database using Add/Remove Database > Database File, and then, adding my .mdb file on the browser...which is located on c:\~\Visual Basic Project\My Project\bin\data.mdb
2. so, when I re-open the properties window of my crystal report, it shows that my database is located on that address..
3. I created the setup file for my program, everything smooth.....then, I install my program onto a test computer.....which is located on....say,
C:\My Program
4.however, when i tried to generate my report, the crystal report generator shows a dialog which says that the database is located on c:\~\Visual Basic Project\My Project\bin\data.mdb
5. I can then fix the problem by re-direct the location to C:\My Program\data.mdb
My question: How to fix this problem by setting the location of my database in Visual Studio as "Application.StartupPath\data.mdb" so the program itself can locate the database on the new computer where it's installed?
PLEASE HELP ME! Thank you in advance.
-Calvin-
-
Aug 1st, 2005, 01:38 PM
#2
Thread Starter
Lively Member
Re: Problem with Database location?
bumped.
I tried lookin on every methods of crystalreportviewer....can't see any menu which can help me setup the path of the database
-
Aug 2nd, 2005, 10:22 AM
#3
Thread Starter
Lively Member
Re: Problem with Database location?
bumped again today.
i really need an input guys...
-
Aug 2nd, 2005, 11:51 AM
#4
Re: Problem with Database location?
Using Cr 8.5 I use the following sub:
VB Code:
Public Sub Set_Crystal_Datatables(ByVal intNum As Integer)
Dim i As Integer
For i = 0 To intNum
fMainForm.crRep.DataFiles(i) = gstrLoc & "\" & gDBName
Next i
End Sub
I pass in the number of data tables in the report.
The gstrLoc is a Public string var that hold the location of that database based on the users installation. The gDBName is a global var that holds the name of the Access database (which can be renamed by the user).
It runs a little different for other versions of CR and different also if using the API to perform printing, and differnt also for subreports.
-
Aug 2nd, 2005, 12:19 PM
#5
Thread Starter
Lively Member
Re: Problem with Database location?
thank you very much for the reply..
so, u used DataFiles() method to setup the database path?
im currently trying to find it..
-
Aug 2nd, 2005, 01:15 PM
#6
Re: Problem with Database location?
I am using the OCX to print the reports. Not the API engine calls remember that. I might have a code section somewhere else that uses the API engine also I'll have to look. Let me know if you need it.
Home e-mail
Work e-mail
-
Aug 2nd, 2005, 01:57 PM
#7
Addicted Member
Re: Problem with Database location?
did you use the wizard to add the crystal report? you can set it up through that. it worked for my sql connection to a server.
-
Aug 3rd, 2005, 08:04 AM
#8
Thread Starter
Lively Member
Re: Problem with Database location?
hi!
no.....
i did it manually by code.......i know im very amateur about the automation..
can you please tell me how?
VB Code:
Dim crystalreport As New SMCReport
Dim quoteNo As Integer = QuoteWindow.quoteNumberToSetup
Dim model As String = QuoteWindow.modelTypeToSetup
Dim full As String = "Total Price"
Dim datapath As String = Application.StartupPath & "\SMC_DATABASE.mdb"
ReportGenerator.SelectionFormula = "{tblOrderInfo.OrderID} = " & quoteNo & " "
ReportGenerator.SelectionFormula = "{tblOrderInfo.ProductType} like '" & quoteNo & "' "
ReportGenerator.SelectionFormula = "not ({tblOrderFeatures.Features} like '" & full & "') and {tblOrderFeatures.OrderID} = " & quoteNo & " "
ReportGenerator.ReportSource() = crystalreport
crystalreport.SetDatabaseLogon("", "", "Microsoft.Jet.OLEDB.4.0", datapath)
-
Aug 3rd, 2005, 08:24 AM
#9
Thread Starter
Lively Member
Re: Problem with Database location?
Guys.......PLEASE help me out..
i feel so stressed out with this crystal report.....im approaching deadline.....but i still can't solve many problems regarding this F***in report.... (im sorry..)
to make it clear...here's the first two problems that's been pissing me off for quite a while...

Number 1: How to remove that tree view when the viewer loads up??? OMG.
Number 2: this is what i've been telling u guys on this thread.......as u can see...it ALWAYS points into the directory on my development computer....
-
Aug 3rd, 2005, 09:02 AM
#10
Addicted Member
Re: Problem with Database location?
the viewer control has a property "displaygroup tree". you set that to false. you setup your report source to the physical location of the report.
i.e. c:/desktop/crystalreport1.rpt or
app.startuppath /bin/crystal.rpt
if you are using visual studio i highly recommend project>add item>crystal report, then follow the wizard.
i am just starting to use crystal reports so if you should try msdn if the forum isnt helping.
-
Aug 3rd, 2005, 09:24 AM
#11
Thread Starter
Lively Member
Re: Problem with Database location?
Thanx again for the reply...
the problem is that....there's a method to turn on the group tree view....but not do turn it off.....there's a toggle to turnon/off the grouptree BUTTON though.... which doesn't help...
as you can see on my previous post (two posts above ur post), I've tried to re-setup the database location onto my application startup path....not that doesn't work..
I tried to create a new crystal report using wizard....but it always add new database using that "C:\........." location..... I can't seem to set so CR look on the application startup path..
-
Aug 3rd, 2005, 09:38 AM
#12
Re: Problem with Database location?
The last post I gave example in was how I did this using CR 8.5. If using CR 9 I do the following:
VB Code:
Public Sub DisplayReport()
Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
Dim strPNameP As String
Set m_Rep = Nothing
strPNameP = mRepName
mRepName = App.Path & "\" & mRepName
Set m_Rep = m_App.OpenReport(mRepName, 1)
m_Rep.RecordSelectionFormula = mstrW
Set ConnectionInfo = m_Rep.Database.Tables(1).ConnectionProperties
On Error Resume Next
m_Rep.Database.Tables(1).DllName = "crdb_dao.dll"
ConnectionInfo.DeleteAll
ConnectionInfo.Add "Database Name", test
ConnectionInfo.Add "Session UserID", "Report"
ConnectionInfo.Add "Session Password", ""
ConnectionInfo.Add "System Database Path", gstrDBLoc & "\Security.mdw"
If strPNameP = "FSSResultsbyNuclide(Area)_New.rpt" Then
m_Rep.ReportTitle = "Sample Results by Rank"
ElseIf strPNameP = "FSSSamplesforAreaDetail_New.rpt" Then
m_Rep.ReportTitle = "Sample Analysis Results by Area"
ElseIf strPNameP = "DataFrequencyPlot.rpt" Then
m_Rep.ReportTitle = "Data Frequency Plot for " & fRepGen.cboIsotopes.Text
ElseIf strPNameP = "E600SurveysinArea.rpt" Then
m_Rep.ReportTitle = msRepTitle
ElseIf strPNameP = "DataQuantPlot.rpt" Then
m_Rep.ReportTitle = "Data Quantile Plot for " & fRepGen.cboIsotopes.Text
End If
crView.ReportSource = m_Rep
crView.ViewReport
crView.Zoom 1
Set m_Rep = Nothing
End Sub
In the Declearation section of the form is the following:
VB Code:
Private m_App As New CRAXDDRT.Application
Private m_Rep As New CRAXDDRT.Report
Public mRepName As String
Public mstrW As String
Public mstrUName As String
Public msRepTitle As String
Sometimes the Programmer
Sometimes the DBA
Mazz1
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
|