Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: VB6 Connection Post Reply Post New Topic
Author Message
TheLimp
Newbie
Newbie
Avatar

Joined: 13 Jun 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote TheLimp Replybullet Topic: VB6 Connection
    Posted: 13 Jun 2008 at 5:03am
Hi,

I have trawled the internet for days trying to find a solution to this problem but to no avail.

I am using CR XI, VB6, SQL Server 2000

I have a PC and a laptop. SQL Server sits on the Laptop.
The Report uses an OLE DB ADO connection.

When opening the report on either computers in CR XI it connects correct when user name a password are entered.

When opening the report on the Laptop via VB6 it works correclty

THe problem is when I try to open the report on my PC via VB6. It uses the exact same code as is running on the laptop but it returns the following error:

Logon failed.
Details:  [Database Vendor Code: 18456 ]

Below is the code:

    Dim crConnectionProp As CRAXDRT.ConnectionProperties
    Dim crSection As CRAXDRT.Section
    Dim crSections As CRAXDRT.Sections
    Dim crxSubreportObject As Variant
    Dim crxSubreport As Variant
    Dim aReport As Variant
    Dim sTableName As String
    On Error GoTo Hell
    sCurProc = "LoadReport"

    Set crApp = New CRAXDRT.Application

    aReport = GetReport(sReport)

    Set crReport = crApp.OpenReport(aReport(0))
    Set crTables = crReport.Database.Tables

    crReport.Database.Tables(1).DllName = "crdb_ado.dll"
  
    For Each crTable In crTables
        Set crConnectionProp = crTable.ConnectionProperties
        sTableName = crTable.Location
        crConnectionProp.DeleteAll
       
        crConnectionProp.add "Provider", "SQLOLEDB"
        crConnectionProp.add "Date Source", sSQLServer
        crConnectionProp.add "Initial Catalog", sDSN
        crConnectionProp.add "User ID", sUID
        crConnectionProp.add "Password", sPassword
        crConnectionProp.add "INTEGRATED SECURITY", False
        crTable.Location = sDSN & ".dbo." & sTableName
Next
This Line is where the error occurs.

The Server, database name etc are all correct.

The other things is I dont think this is a Database problem but I could be wrong here... "Details:  [Database Vendor Code: 18456 ]" indicates its a Database problem but this error does not appear in the Server logs..!

Can anyone help me out here. Im pulling my hair out!

Cheers


Edited by TheLimp - 13 Jun 2008 at 5:04am
IP IP Logged
GHanosh
Newbie
Newbie
Avatar

Joined: 10 Jul 2008
Online Status: Offline
Posts: 10
Quote GHanosh Replybullet Posted: 15 Jul 2008 at 8:10am
Good God, I feel your pain.  I still have my hair though so if you'd like to collaborate here perhaps together we can solve this problem.  Mine is similar but like yours not there yet.
 
Please respond.
IP IP Logged
GHanosh
Newbie
Newbie
Avatar

Joined: 10 Jul 2008
Online Status: Offline
Posts: 10
Quote GHanosh Replybullet Posted: 15 Jul 2008 at 8:12am
I've tried a number of different things and all unsuccessful.  One thing though - your line of code:  crTable.Location = sDSN & ".dbo." & sTableName
I think crTable.Location is a read-only property.
IP IP Logged
TheLimp
Newbie
Newbie
Avatar

Joined: 13 Jun 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote TheLimp Replybullet Posted: 15 Jul 2008 at 8:18am
 table.location is not a read only property.

This is the code that fixed the problem. I hope it help some.

    For Each crTable In crTables
        Set crConnectionProp = crTable.ConnectionProperties
        sTableName = crTable.Location
        crConnectionProp.DeleteAll
        crConnectionProp.add "Provider", "SQLOLEDB"
        crConnectionProp.add "Date Source", sSQLServer
        crConnectionProp.add "Initial Catalog", sDSN
        crConnectionProp.add "User ID", sUID
        crConnectionProp.add "Password", sPassword
        crTable.SetLogOnInfo sSQLServer, sDSN, sUID, sPassword
        crTable.Location = sDSN & ".dbo." & sTableName
        crReport.Database.Verify
    Next


IP IP Logged
GHanosh
Newbie
Newbie
Avatar

Joined: 10 Jul 2008
Online Status: Offline
Posts: 10
Quote GHanosh Replybullet Posted: 15 Jul 2008 at 8:32am
Wow.  Thanks for the lightning fast response.  When my code hits "crReport.Database.Verify" I get the message that my logon is failing. 
 
I think I've tried everything!  What the heck am I missing?
IP IP Logged
TheLimp
Newbie
Newbie
Avatar

Joined: 13 Jun 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote TheLimp Replybullet Posted: 15 Jul 2008 at 8:38am
Sorry But I have to say this problem was just trial n error until I got it to work. I twas a nightmare to say the least.

Here is a link to a PDF that didnt solve my problem but did help.

http://resources.businessobjects.com/support/communitycs/TechnicalPapers/cr_rdc9_connectionproperties.pdf

Good Luck
IP IP Logged
GHanosh
Newbie
Newbie
Avatar

Joined: 10 Jul 2008
Online Status: Offline
Posts: 10
Quote GHanosh Replybullet Posted: 15 Jul 2008 at 8:42am

Thanks so much.  I still have my hair but alas a few dents in my head from beating it against the table.

These boys at Crystal, BO, SAP, whatever, they sure didn't make this easy.  I may switch to something else.

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.