Error setting data source to SQL server 
Author Message
 Error setting data source to SQL server

I have written the following code to set the data source to SQL server
in Crystal Report.

    Dim CPProperties As CRAXDRT.ConnectionProperties
    Dim CPProperty As CRAXDRT.ConnectionProperty
    Dim DBTable As CRAXDRT.DatabaseTable
    Dim sTableName As String
    Dim sCommand As String
    Dim iTabCount As Integer
    Dim iCount As Integer

    On Error GoTo ErrHdlr_Set

    iTabCount = m_oReport.Database.Tables.Count

    For iCount = 1 To iTabCount
        ' Get the first table in the report.
        Set DBTable = m_oReport.Database.Tables(iCount)

        'retrieve the table name
        sTableName = DBTable.Name

        ' Get the collection of connection properties.
        Set CPProperties = DBTable.ConnectionProperties
        CPProperties.DeleteAll

        CPProperties.Add "DLLName", "crdb_ado.dll"
        CPProperties.Add "Provider", "SQLOLEDB"
       CPProperties.Add "Server", "TEST"
        CPProperties.Add "Database", "TEST DATABASE"
        CPProperties.Add "Integrated Security", "True"

        DBTable.Location = "TEST"
    Next iCount

where test is the table name. Whenever I run to this line
DBTable.Location = "TEST" I get this error: Database dll crdb_ado.dll
could not be loaded. Any idea why this is happening?

Thank you.



Sun, 11 Sep 2005 03:15:12 GMT  
 Error setting data source to SQL server
Is that DLL available on the target machine?  Also, don't set the Location,
read it before deleting all the connection properties and then set it back
to what it was, i.e.

   strLocation = dbTable.Location
   .
   .
   .
   dbTable.Location = strLocation

Neil.


Quote:
> I have written the following code to set the data source to SQL server
> in crystal report.

>     Dim CPProperties As CRAXDRT.ConnectionProperties
>     Dim CPProperty As CRAXDRT.ConnectionProperty
>     Dim DBTable As CRAXDRT.DatabaseTable
>     Dim sTableName As String
>     Dim sCommand As String
>     Dim iTabCount As Integer
>     Dim iCount As Integer

>     On Error GoTo ErrHdlr_Set

>     iTabCount = m_oReport.Database.Tables.Count

>     For iCount = 1 To iTabCount
>         ' Get the first table in the report.
>         Set DBTable = m_oReport.Database.Tables(iCount)

>         'retrieve the table name
>         sTableName = DBTable.Name

>         ' Get the collection of connection properties.
>         Set CPProperties = DBTable.ConnectionProperties
>         CPProperties.DeleteAll

>         CPProperties.Add "DLLName", "crdb_ado.dll"
>         CPProperties.Add "Provider", "SQLOLEDB"
>        CPProperties.Add "Server", "TEST"
>         CPProperties.Add "Database", "TEST DATABASE"
>         CPProperties.Add "Integrated Security", "True"

>         DBTable.Location = "TEST"
>     Next iCount

> where test is the table name. Whenever I run to this line
> DBTable.Location = "TEST" I get this error: Database dll crdb_ado.dll
> could not be loaded. Any idea why this is happening?

> Thank you.



Sun, 11 Sep 2005 08:01:02 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Listing SQL Server 2000 Data Sources in VB6

2. Looking for Info on converting reports from access to sql server data source

3. Sql server data source

4. i get error when i set up ODBC data source (access) with crystal

5. An Error has occured on the server in attempting to access the data source

6. Getting error message when using SQL for data source in ADOC

7. What's the best settings in Data Environment when using MS SQL Server

8. SQL Server changed language settings error

9. Setting Data Definition file data source at run time

10. Create Single Data Set from mulitple data sources

11. Data objects closed error in ADO 2.1 and SQL server 6.5

12. hstmt errors with data object and sql server?

 

 
Powered by phpBB® Forum Software