Results 1 to 12 of 12

Thread: Problem with Database location?

  1. #1

    Thread Starter
    Lively Member zen_master's Avatar
    Join Date
    Apr 2005
    Location
    Buffalo, NY
    Posts
    114

    Exclamation 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-

  2. #2

    Thread Starter
    Lively Member zen_master's Avatar
    Join Date
    Apr 2005
    Location
    Buffalo, NY
    Posts
    114

    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

  3. #3

    Thread Starter
    Lively Member zen_master's Avatar
    Join Date
    Apr 2005
    Location
    Buffalo, NY
    Posts
    114

    Re: Problem with Database location?

    bumped again today.

    i really need an input guys...

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Problem with Database location?

    Using Cr 8.5 I use the following sub:

    VB Code:
    1. Public Sub Set_Crystal_Datatables(ByVal intNum As Integer)
    2. Dim i As Integer
    3.  
    4. For i = 0 To intNum
    5.     fMainForm.crRep.DataFiles(i) = gstrLoc & "\" & gDBName
    6. Next i
    7.  
    8. 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.

  5. #5

    Thread Starter
    Lively Member zen_master's Avatar
    Join Date
    Apr 2005
    Location
    Buffalo, NY
    Posts
    114

    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..

  6. #6
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    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

  7. #7
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    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.

  8. #8

    Thread Starter
    Lively Member zen_master's Avatar
    Join Date
    Apr 2005
    Location
    Buffalo, NY
    Posts
    114

    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:
    1. Dim crystalreport As New SMCReport
    2.             Dim quoteNo As Integer = QuoteWindow.quoteNumberToSetup
    3.             Dim model As String = QuoteWindow.modelTypeToSetup
    4.             Dim full As String = "Total Price"
    5.  
    6.             Dim datapath As String = Application.StartupPath & "\SMC_DATABASE.mdb"
    7.  
    8.             ReportGenerator.SelectionFormula = "{tblOrderInfo.OrderID} = " & quoteNo & " "
    9.             ReportGenerator.SelectionFormula = "{tblOrderInfo.ProductType} like '" & quoteNo & "' "
    10.             ReportGenerator.SelectionFormula = "not ({tblOrderFeatures.Features} like '" & full & "') and {tblOrderFeatures.OrderID} = " & quoteNo & " "
    11.  
    12.             ReportGenerator.ReportSource() = crystalreport
    13.             crystalreport.SetDatabaseLogon("", "", "Microsoft.Jet.OLEDB.4.0", datapath)

  9. #9

    Thread Starter
    Lively Member zen_master's Avatar
    Join Date
    Apr 2005
    Location
    Buffalo, NY
    Posts
    114

    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....

  10. #10
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    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.

  11. #11

    Thread Starter
    Lively Member zen_master's Avatar
    Join Date
    Apr 2005
    Location
    Buffalo, NY
    Posts
    114

    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..

  12. #12
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    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:
    1. Public Sub DisplayReport()
    2. Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
    3. Dim strPNameP As String
    4.  
    5. Set m_Rep = Nothing
    6. strPNameP = mRepName
    7. mRepName = App.Path & "\" & mRepName
    8.  
    9. Set m_Rep = m_App.OpenReport(mRepName, 1)
    10. m_Rep.RecordSelectionFormula = mstrW
    11.  
    12. Set ConnectionInfo = m_Rep.Database.Tables(1).ConnectionProperties
    13. On Error Resume Next
    14. m_Rep.Database.Tables(1).DllName = "crdb_dao.dll"
    15. ConnectionInfo.DeleteAll
    16. ConnectionInfo.Add "Database Name", test
    17. ConnectionInfo.Add "Session UserID", "Report"
    18. ConnectionInfo.Add "Session Password", ""
    19. ConnectionInfo.Add "System Database Path", gstrDBLoc & "\Security.mdw"
    20.  
    21.  
    22. If strPNameP = "FSSResultsbyNuclide(Area)_New.rpt" Then
    23.     m_Rep.ReportTitle = "Sample Results by Rank"
    24. ElseIf strPNameP = "FSSSamplesforAreaDetail_New.rpt" Then
    25.     m_Rep.ReportTitle = "Sample Analysis Results by Area"
    26. ElseIf strPNameP = "DataFrequencyPlot.rpt" Then
    27.     m_Rep.ReportTitle = "Data Frequency Plot for " & fRepGen.cboIsotopes.Text
    28. ElseIf strPNameP = "E600SurveysinArea.rpt" Then
    29.     m_Rep.ReportTitle = msRepTitle
    30. ElseIf strPNameP = "DataQuantPlot.rpt" Then
    31.     m_Rep.ReportTitle = "Data Quantile Plot for " & fRepGen.cboIsotopes.Text
    32. End If
    33.  
    34. crView.ReportSource = m_Rep
    35.  
    36. crView.ViewReport
    37. crView.Zoom 1
    38.  
    39. Set m_Rep = Nothing
    40.  
    41. End Sub

    In the Declearation section of the form is the following:

    VB Code:
    1. Private m_App As New CRAXDDRT.Application
    2. Private m_Rep As New CRAXDDRT.Report
    3. Public mRepName As String
    4. Public mstrW As String
    5. Public mstrUName As String
    6. 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
  •  



Click Here to Expand Forum to Full Width