🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1763

Problems reading udl-File

#1763
From: Georg Nowak
Date: Sun, 22 Feb 2004 17:02
59 lines
2957 bytes
Hello,

I have got a strange problem here and it might be even hard to explain
it, but I do my best:

1) I'm developing a small application, where the user should have the
possibility to create dynamic
database access commands to databases, which are unknown now (e.g. he
should get the possibility to read a field from a table in a
database). So I create an empty udl file and start the MS-Tool with
which it is possible to create an ADO Connection string (I don't know
the english name for it - sorry) using

  AnsiString ADOFileName = "c:\test.udl";

  TCustomFileRun *cfr = new TCustomFileRun(FBSC) ;
  cfr->FileName = ADOFileName;
  cfr->Execute();
  delete cfr;

This works fine so far. As soon as I close the MS Tool the database
connection string is available:

[oledb]
; Everything after this line is an OLE DB initstring
Provider=MSDASQL.1;Persist Security Info=False;Extended
Properties="DSN=Microsoft Access-Datenbank;DBQ=C:\Dokumente und
Einstellungen\Georg Nowak\Eigene
Dateien\Studium\Diplomarbeit\Balanced_Scorecard.mdb_old;DefaultDir=C:\Dokumente
und Einstellungen\Test\Eigene
Dateien\Studium\Diplomarbeit;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"


2) Now my problem: I cannot read this file using   

  AnsiString ADOFileName2 = ADOFileName;
  // AnsiString ADOFileName2 = "c:\test.udl";
  TStringList *sl = new TStringList ();
  sl->LoadFromFile(ADOFileName2);
 
I tried several other ways to read that file (even fopen :( ), but all
with the same result: The string I get is always strange and not what
is in the file, but I can open the file with a Texteditor and it looks
fine !?

I made several test:
1) I copied the string from the udl file to an other udl file and
tried the LoadFromFile from the new file: result: works fine
2) Changing the file name doesn't help at all
3) As soon as ADOFileName is the same for TCustomFileRun and
LoadFromFile it does not work. Once the MS-Tool has written something
in the file, it is not possible to read it with LoadFromFile, fopen or
FileRead.

Any help would be great...

Thanks !
Georg
Technical Details
Message-ID: <e7d8e959.0402220902.6b6a3f5b@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,34b4aaa2463ad0b4,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-02-22 09:02:18 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: Georg.Nowak@sms-demag.de (Georg Nowak)
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Problems reading udl-File
Date: 22 Feb 2004 09:02:18 -0800
Organization: http://groups.google.com
Lines: 59
Message-ID: <e7d8e959.0402220902.6b6a3f5b@posting.google.com>
NNTP-Posting-Host: 80.146.76.63
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1077469338 22366 127.0.0.1 (22 Feb 2004 17:02:18 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 22 Feb 2004 17:02:18 +0000 (UTC)