BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help : Any one known that Use ADOconnection. execute

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
fx -117
Guest





PostPosted: Sat Jul 31, 2004 4:28 am    Post subject: Help : Any one known that Use ADOconnection. execute Reply with quote



Hello All :

I have problem to uses ADOConnection. exceute .
I want to Export a MsSql data to excel, but not work.
I was test that if Export data from paradox to excel. but in Msql
to excel which show Error message ( like its [Mircosoft],[ Excel dirver]
error in "From" )
I don't kown how to Fix it.


Any one can help me ?


Thank.
FX-117

//==========================================================================
==


procedure TForm1.BitBtn4Click(Sender: TObject);
var
wfile:String;
nfile:String;
cString, tmp1,wpath:string;
begin
if savedialog1.Execute then
begin
wfile:=savedialog1.FileName;
nfile:=savedialog1.FileName+'.xls';
if FileExists(wfile) then
if(messagebox(handle,' THE EXCEL FILES IS EXISTED , ARE SURE TO
OVER WRITE?'',mb_okcancel)=idok) then
DeleteFile(wfile)
else
exit;
if FileExists(nfile) then
if(messagebox(handle,'THE EXCEL FILES IS EXISTED',mb_okcancel)=idok)
then
DeleteFile(nfile)
else
exit;
wpath:=ExtractFilepath(wfile);
end
else
exit;


// Export to Excel;
try
ADOConnection3.ConnectionString:='Provider=MSDASQL.1;Persist Security
Info=False;'
+'Extended Properties="DSN=Excel
Files;DBQ='

+wfile+';DefaultDir='+wpath+';DriverId=790;'
+'MaxBufferSize=2048;PageTimeout=5;"';
ADOConnection3.Connected:=True;

Tmp:=extractfilepath(application.exename);

// cString:='select * INTO VTable from [Paradox
7.x;database='+Tmp1+'].GC.db'; // OK for Export to Paradox 7

// No work, if Export MSSQL data to Excel files .
cString:= 'SELECT * INTO VTable FROM OPENROWSET(''SQLOLEDB'',''
MYSQL2000 '';''sa'';,''SELECT * FROM MDDB.dbo.CUST_INFROM '')';



ADOConnection3.Execute(nn);
ADOConnection3.Connected:=False;
SHOWMessage('OK!');
except
Showmessage('Export Failure '); // Failure in Export to excel
files.
exit;
end;


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.