Article View: borland.public.cppbuilder.database.ado
Article #1029Re: MS Access databases and SQL insert
From: Viatcheslav V. Vassiliev
Date: Wed, 15 Dec 2004 09:50
Date: Wed, 15 Dec 2004 09:50
60 lines
3291 bytes
3291 bytes
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:
<41c008d4@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!border1.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>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,616038963bb3e51 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <41bf77e4@newsgroups.borland.com> Subject: Re: MS Access databases and SQL insert Date: Wed, 15 Dec 2004 12:50:12 +0300 Lines: 62 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 217.73.240.22 Message-ID: <41c008d4@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1103104212 217.73.240.22 (15 Dec 2004 01:50:12 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!border1.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