Results 1 to 7 of 7

Thread: vb 6.0,crystal reports 8.0,PostgreSQL(win)

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    6

    vb 6.0,crystal reports 8.0,PostgreSQL(win)

    Hello :


    please help , i'm working with Postgresql i can connect to it (odbc and oledb) when i try to generate a report using the crviewer i got very confused with the connection methods(Logoninfo ,logon server etc) and with the dll that i need inside the project i already got the active x run time library , but i don't know if i need to incorporate to the reference another dll type .


    please help

    thanks in advanced

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Lightbulb Re: vb 6.0,crystal reports 8.0,PostgreSQL(win)

    If you want to use the crystal report in the VB then there is crystal report tutorial at my signature so click there.
    You are using just you check the connection with the database and the Query.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    6

    Re: vb 6.0,crystal reports 8.0,PostgreSQL(win)

    thanks for the reply , but i still have the problem, i'm going to post some code,(you will have to forgive me but , i don't how to post the code the rigth way) :

    make the connection :

    Private Sub crearConexion()
    Dim cadenaConexion As String
    cadenaConexion = "DRIVER={PostgreSQL};SERVER=192.168.25.197;port=5432;DATABASE=test;UID=postgres;PWD=post;"
    Set conexion = New ADODB.Connection
    conexion.Open cadenaConexion
    Set consultaSQL = New ADODB.Command
    Set consultaSQL.ActiveConnection = conexion
    End Sub


    load the report :

    Public Function CargarReporte(strTitulo As String, strArchivoRPT As String, strCadenaSQL As String, Optional strSpDatosAdicionales As String = "spCorporativo") As CRAXDRT.Report
    Call crearConexion
    Dim rdApp As CRAXDRT.Application
    Dim Report As CRAXDRT.Report

    Screen.MousePointer = vbHourglass


    Set rdApp = CreateObject("CrystalRuntime.Application")
    Set Report = rdApp.OpenReport(strArchivoRPT)
    Report.ReportTitle = strTitulo


    consultaSQL.CommandText = strCadenaSQL
    consultaSQL.CommandType = adCmdText
    Set recordSet = consultaSQL.Execute
    Report.Database.AddADOCommand conexion, consultaSQL

    Report.AutoSetUnboundFieldSource crBMTName


    Call cerrarConexion
    Set rdApp = Nothing

    Set CargarReporte = Report
    Screen.MousePointer = vbDefault
    End Function


    again thanks

  4. #4
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question Re: vb 6.0,crystal reports 8.0,PostgreSQL(win)

    You post the code, use use VBCODE tab In [] and code and end it with the same way [/VBCDOE].
    Tell that in which line error you are getting and what type of the error is it.

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    6

    Re: vb 6.0,crystal reports 8.0,PostgreSQL(win)

    thanks, the problem is that the program crash , send a message that the vb has suffer an unexpected error. when you click on the link , you can see "p2smon.dll" , this is the reason of the unexpected error.



    make the connection :

    VB Code:
    1. Private Sub crearConexion()
    2. Dim cadenaConexion As String
    3. cadenaConexion = "DRIVER={PostgreSQL};SERVER=192.168.25.197;port=5432;DATABASE=test;UID=postgres;PWD=post;"
    4. Set conexion = New ADODB.Connection
    5. conexion.Open cadenaConexion
    6. Set consultaSQL = New ADODB.Command
    7. Set consultaSQL.ActiveConnection = conexion
    8. End Sub


    load the report:

    VB Code:
    1. Public Function CargarReporte(strTitulo As String, strArchivoRPT As String, strCadenaSQL As String, Optional strSpDatosAdicionales As String = "spCorporativo") As CRAXDRT.Report
    2.  
    3. Call crearConexion
    4. Dim rdApp As CRAXDRT.Application
    5. Dim Report As CRAXDRT.Report
    6.  
    7. Screen.MousePointer = vbHourglass
    8.  
    9.  
    10. Set rdApp = CreateObject("CrystalRuntime.Application")
    11. Set Report = rdApp.OpenReport(strArchivoRPT)
    12. Report.ReportTitle = strTitulo
    13.  
    14.  
    15. consultaSQL.CommandText = strCadenaSQL
    16. consultaSQL.CommandType = adCmdText
    17. Set recordSet = consultaSQL.Execute
    18. Report.Database.AddADOCommand conexion, consultaSQL
    19.  
    20. Report.AutoSetUnboundFieldSource crBMTName
    21.  
    22.  
    23. Call cerrarConexion
    24. Set rdApp = Nothing
    25.  
    26. Set CargarReporte = Report
    27. Screen.MousePointer = vbDefault
    28. End Function

    thank you shakti5385

  6. #6
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: vb 6.0,crystal reports 8.0,PostgreSQL(win)


    So you are still getting the error, to find out that in which line error is occurring please debug the code using the F8.
    You are saying something about the dll so I want to say that please check that the dll is registered on your PC or not, For registering the dll just write regsvr32 and the dll path at the run prompt.
    Start ->Run -> regsvr32 dll path


  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    6

    Re: vb 6.0,crystal reports 8.0,PostgreSQL(win)

    i can't debug because the program stuck . i can't use f8 or anything. the message that it's been send state that , "due to an unexpected error viusla basic has to shut down" , and also include a link to see what originate the error , in this part is where the name of the .dll it`s shown. i got .dll registred , thats fine .

    maybe my problem its the way i'm doing the connection and passing to report . i don't know.

    i'm taking a wild guess that the error is generated here.

    conexion = connection
    consultaSQL= query sentence

    VB Code:
    1. Report.Database.AddADOCommand conexion, consultaSQL

    thanks shakti5385

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