🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: BCB6 Follow-up

#552
From: Viatcheslav V. Vassiliev
Date: Mon, 14 Nov 2005 22:10
101 lines
5329 bytes
//
// MessageId: DB_E_BADINITSTRING
//
// MessageText:
//
//  Format of the initialization string does not conform to the OLE DB 
specification.
//
#define DB_E_BADINITSTRING               ((HRESULT)0x80040E73L)


> 80:      char createfile[MAXPATH];
> 81:      strcpy(createfile, OpenDialog1->FileName.c_str());
> 82:      cat->Create(WideString(createfile).c_bstr());

Connection string is not just file name. You should build connection string 
in form:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\test.mdb"

as you did at beginning. The same is for:

> 83:      ADOConnection1->ConnectionString =
> 84:                      ConnectionString(OpenDialog1->FileName.c_str());

Do not know what ConnectionString() procedure is for, may be it should be 
applied when you create database.

Add also

cat.Release();

after creating database.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + 
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"poojo hackma" <poojo.com/mail> �������/�������� � �������� ���������: 
news:4378b969@newsgroups.borland.com...
> Viatcheslav,
>
> In my code listed below, Line 82 is throwing this error:
>
> (this->Create(ConnectString, (VARIANT*)&Connection))
> Error: 80040E73(-2147217805) @ C:\Program 
> Files\Borland\CBuilder6\Imports\ADOX_tlb.h/487
> Press [Y]es to terminate, [N]o to continue and [C]ancel to Debug.
>
> I have included the rest of my CREATE TABLE sql in the hopes that you (or 
> someone) can point out what will go wrong next before I get there.  Some 
> of the column names are reserved words; so do I need to include them in 
> [bracket]s?  Also, the examples I found only listed a type of "Int" and I 
> needed to distinguish between "Long Integer" and "Double;" so I 
> substituted "Int" in the code that I found online with those values ("Long 
> Integer" and "Double").  Am I doomed???  If so, could someone point me in 
> the right direction?
>
> 74:  if (FileExists(OpenDialog1->FileName) == false) {
> 75:    OpenDialog1->Execute();
> 76:  }
> 77:  if (FileExists(OpenDialog1->FileName) == false) {
> 78:    TCOM_Catalog cat = CoCatalog::Create();
> 79:    try { // read in the database
> 80:      char createfile[MAXPATH];
> 81:      strcpy(createfile, OpenDialog1->FileName.c_str());
> 82:      cat->Create(WideString(createfile).c_bstr());
> 83:      ADOConnection1->ConnectionString =
> 84:                      ConnectionString(OpenDialog1->FileName.c_str());
> 85:      ADOQuery1->SQL->Clear();
> 86:      ADOQuery1->SQL->Add("CREATE TABLE Table1 (");
> 87:      ADOQuery1->SQL->Add(" ID Long Integer Identity Primary Key,");
> 88:      ADOQuery1->SQL->Add(" Desc VarChar(50),");
> 89:      ADOQuery1->SQL->Add(" Len Long Integer, Res Double, Val 
> Double,");
> 90:      ADOQuery1->SQL->Add(" Ofs Double, Min Double, Max Double,");
> 91:      ADOQuery1->SQL->Add(" Unit VarChar(10), Type VarChar(50),");
> 92:      ADOQuery1->SQL->Add(" Sus Long Integer, PGN Long Integer,");
> 93:      ADOQuery1->SQL->Add(" start Long Integer)");
> 94:      ADOQuery1->ExecSQL();
> 95:      ADOQuery1->Close();
> 96:      ComboBox1->Items->Add("Add New");
> 97:    } catch (Exception* ex) {
> 98:      MessageBox(NULL, ex->Message.c_str(), "DB Exception", MB_OK);
> 99:    }
> A0:  }
>
> I apologize for having to take up so much of your time.  Is there 
> somewhere I can find this information on my own?  I'm trying to reduce the 
> amount of time you are spending with me.  I've been trying to read old 
> messages of yours.  One in particular that looks very relevant is located 
> at:
> http://groups.google.com/group/borland.public.cppbuilder.database.ado/browse_thread/thread/624e139e318cdbfb/1fbeae2a8f29cce1?lnk=st&q=ADOX_tlb.h&rnum=2&hl=en#1fbeae2a8f29cce1
> but it does not seem to tell me how to fix the problem I am having.
>
> 
Technical Details
Message-ID: <43790b1d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!217.73.144.45.MISMATCH!feeder2.ecngs.de!ecngs!feeder.ecngs.de!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4374c751$1@newsgroups.borland.com> <4374d7fa$1@newsgroups.borland.com> <4374fc8b@newsgroups.borland.com> <43750df0$1@newsgroups.borland.com> <4375b348$1@newsgroups.borland.com> <4378b969@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,fd44f1fbb79ff20c
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <4374c751$1@newsgroups.borland.com> <4374d7fa$1@newsgroups.borland.com> <4374fc8b@newsgroups.borland.com> <43750df0$1@newsgroups.borland.com> <4375b348$1@newsgroups.borland.com> <4378b969@newsgroups.borland.com>
Subject: Re: BCB6 Follow-up
Date: Tue, 15 Nov 2005 01:10:15 +0300
Lines: 103
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 85.93.138.132
Message-ID: <43790b1d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1132006173 85.93.138.132 (14 Nov 2005 14:09:33 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!217.73.144.45.MISMATCH!feeder2.ecngs.de!ecngs!feeder.ecngs.de!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail