Article View: borland.public.cppbuilder.database.ado
Article #1031Re: MS Access databases and SQL insert
From: Stefano Bonifazi
Date: Wed, 15 Dec 2004 11:15
Date: Wed, 15 Dec 2004 11:15
97 lines
4419 bytes
4419 bytes
Hi Again!
I tried to modify my code as You suggested but the same ugly error showed
:(
My actual code is the following:
DataSource1->DataSet->Active=false;
ADOConnection1->Connected=false;
AnsiString sConnessione="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source="+OpenDialog1->FileName;
ADOConnection1->ConnectionString=sConnessione;
ADOConnection1->Connected=true;
ADODataSet1->CommandText="Select * From MP3TAG";
DataSource1->DataSet->Active=true;
AnsiString SQLCommand=
"INSERT INTO
MP3TAG([Titolo],[Artista],[Album],[Genere],[Anno],[Commento],[File]) "
"VALUES('My Title', 'My Artist', 'My Album', 'My Genre', '1978', 'My
Comment', 'c:\\test.mp3')";
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add(SQLCommand);
ADOQuery1->Open();
What's wrong with that?
Thank You in advance!
Regards,
Stefano B.
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> ha scritto nel
messaggio news:41c008d4@newsgroups.borland.com...
> Use native OLEDB provider.
>
> ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=c:\\temp\\test.mdb";
>
> Do not forget to esace characters in string ('c:\test.mp3' >
> 'c:\\test.mp3'). Enclose column names into [] - ([Title], [Artist] ...
>
> //------------------------------------------
> 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)
>
> "Stefano Bonifazi" <stefboombastic@tele2.it> �������/�������� � ��������
> ���������: news:41bf77e4@newsgroups.borland.com...
>> Hi All!!
>> I'm using an simple test MS Access database.
>> I connect to the db through a TADOConnection with a connection string:
>> "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Database di
>> Microsoft Access;Initial Catalog="+Mp3CatalogsOpenDialog->FileName;
>>
>> Then I have a TADODataSet linked to the prevoius TADOConnection, and a
>> TDataSource linked to the last.
>> Then I have a TDBGrid linked to the TDataSource.
>> Finally I have a TADOQuery linked to the same TADOConnection.
>>
>> I use the TADOQuery to query the database with SQL statements. Both
> "SELECT"
>> and "DELETE" command work fine, but when I try to use INSERT i got the
>> following error message:
>>
>> "[snip] EOleException with message 'The current provider can't give back
>> multiple record sets from a unique execution' [snip]" (note I tried to
>> translate the Italian Error message!)
>>
>> My actual code was:
>>
>> AnsiString SQLCommand=
>>
>> "INSERT INTO MP3TAG(Title,Artist,Album,Genre,Year,Comment,File) "
>> "VALUES('My Title', 'My Artist', 'My Album', 'My Genre', '1978', 'Some
>> comment', 'c:\test.mp3')";
>>
>> ADOQuery1->Close();
>> ADOQuery1->SQL->Clear();
>> ADOQuery1->SQL->Add(SQLCommand);
>> ADOQuery1->Open();
>>
>> What did happen? Should I use another kind of database to enable the sql
>> INSERT command? If so, how to create another type of database?
>> I only own MS Access 2003, where can I find other programs to create
>> databases?
>>
>> Thank You very much in advance!
>> Stefano B.
>>
>>
>
>
Technical Details
Message-ID:
<41c01d2c@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41bf77e4@newsgroups.borland.com> <41c008d4@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,616038963bb3e51 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Stefano Bonifazi" <stefboombastic@tele2.it> Newsgroups: borland.public.cppbuilder.database.ado References: <41bf77e4@newsgroups.borland.com> <41c008d4@newsgroups.borland.com> Subject: Re: MS Access databases and SQL insert Date: Wed, 15 Dec 2004 12:15:31 +0100 Lines: 99 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 212.141.199.129 Message-ID: <41c01d2c@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1103109420 212.141.199.129 (15 Dec 2004 03:17:00 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail