Connect to 2 different SQL server 6.5 Dbs 
Author Message
 Connect to 2 different SQL server 6.5 Dbs

This is my problem:
In an application, I can' t connect to a datatabase different from the
one used to build the report (both the Databases are Sql Server 6.5).
The code of the application is written in C++ Builder 1.0 and is :

---beginning of code

void __fastcall TfrmFRag::menuSchedeProd1Click(TObject *Sender)
{
    // Report Schede Prodotti. La selezione solo su Fam_id.
    TSheetRect SelRect;

    int icodProd;
    int icodStab;
    char *reportFile;
    AnsiString sValue;
    short Job;
    short NameReport;
    short tableN;
    struct PELogOnInfo logOnInfo;
    BOOL propagate;

     sWhere ="";
     tableN = 3;
     propagate = true;
 // Get information on the second table in the report
 // Initialize size of structure

    if (PEOpenEngine()==0)
    {
    PEOpenEngine()==1;
    }

 lstrcpy(reportFile,
"D:\\CriProgetti\\Bp\\CBuilder\\RPTBP_MASTSCHEDE_PROD.RPT");
Job = PEOpenPrintJob(reportFile);

if (Job <= 0){
 // Handle error

Quote:
}

logOnInfo.StructSize = PE_SIZEOF_LOGON_INFO;
if (!PEGetNthTableLogOnInfo(Job, tableN, &logOnInfo)){
 // Handle error

Quote:
}

//PESetNthTableLogOnInfo
 // Log on only valid for the first table.
 // Initialize structure

logOnInfo.StructSize = PE_SIZEOF_LOGON_INFO;
lstrcpy(logOnInfo.ServerName, "BP_ABBIGLIAMENTO");
lstrcpy(logOnInfo.DatabaseName, "BP_ABBIGLIAMENTO");
lstrcpy(logOnInfo.UserID, "sa");
lstrcpy(logOnInfo.Password, "");

if (!PESetNthTableLogOnInfo(Job, tableN, &logOnInfo, propagate)){
 // Handle error

Quote:
}

    if (pcFilter->ActivePage->PageIndex == 0)
    {
        if (grdView->ColCount > 1)
        {

      for(int i= -1; i<grdView->SelCount;i++)
       {
          if (i== -1)
              SelRect = grdView->Selection;
          else
              SelRect=grdView->SavedSelection[i];

          for (int j=SelRect.Top;j<=SelRect.Bottom;j++)
          {
               sValue = grdView->Cells[1][j]; // colonna 1 = fam_id.
                     sWhere = sWhere + " {Query.BPF_FAM_ID} = ('" +
sValue +  "') OR ";
                 }
       }
             sWhere = sWhere.SubString(0,sWhere.Length()-3); //Per
eliminare l'OR alla fine.
       Close();
        }
 }

//**************************************************************************

    //Open report.

//**************************************************************************

    //Per Provarlo.Ora il report in locale nella stessa dir in cui ho
l'exe del progetto.
    CryRep->ReportFileName="RPTBP_MASTSCHEDE_PROD.RPT";
     //La formula di selezione records,definita in design, deve venire
modificata.
    CryRep->Formulas[0] = "SELQuery = " + sWhere;
    CryRep->Action = 1;

Quote:
}

---end of  code

If I could not change runtime the Database for the report data all my
work will be pointless.

thank you
Cristina Falzoni.



Sat, 25 Nov 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Connect to 2 different SQL Server 6.5 db

2. ODBC Connect to SQL server 6.5

3. connecting to MS SQL Server 6.5 using VB5

4. Connect to SQL-Server 6.5

5. How to connect to SQL Server 6.5 using VB 5.0

6. Connecting to SQL Server 6.5 and 7.0

7. New Transact-SQL Debugger for Microsoft SQL Server 6.5/7.0

8. Import text file in SQL Server 6.5 via SQL in Visual Basic

9. SQL Debugger for Microsoft SQL Server 7.0 and 6.5

10. Import text file in SQL Server 6.5 via SQL in Visual Basic

11. Pls Help-VB4 w/SQL 6.5 can't connect

12. Urgent : VB6 ADO Connecting to SQL 6.5

 

 
Powered by phpBB® Forum Software