I
IWTBAH
Unregistered / Unconfirmed
GUEST, unregistred user!
目的:我想使用SQL Server 提供的Activex将SQL Server的数据结构导出到xml文件
问题:连接不了数据库,在执行到下面的代码open时报错,请问我的连接字符窜应该怎么写?
我的方法:
var
oExp : Export;
oMyObj1 : RepositoryObject;
oMyObj2 : RepositoryObject;
oRep : Repository;
oRoot : RepositoryObject;
begin
oRep := CreateComObject(CLASS_Repository) as IRepository;
oRoot := oRep.Open('SERVER=myserver;DATABASE=test;UID=test;PWD=','test','',0);
oMyObj1 :=oRep.Object_['TESTTBL1'];
oMyObj2 :=oRep.Object_['TESTTBL2'];
oExp := CreateComObject(CLASS_Export) as IExport;
oExp.add(oMyObj1, 0);
oExp.add(oMyObj2, 0);
oExp.Export('c:/temp/myXmlFile.xml', 0);
oMyObj1:=nil;
oMyObj2:=nil;
oRoot:=nil;
oRep:=nil;
oExp:=nil;
参考:Sql Server的帮助项Export xml中的example
问题:连接不了数据库,在执行到下面的代码open时报错,请问我的连接字符窜应该怎么写?
我的方法:
var
oExp : Export;
oMyObj1 : RepositoryObject;
oMyObj2 : RepositoryObject;
oRep : Repository;
oRoot : RepositoryObject;
begin
oRep := CreateComObject(CLASS_Repository) as IRepository;
oRoot := oRep.Open('SERVER=myserver;DATABASE=test;UID=test;PWD=','test','',0);
oMyObj1 :=oRep.Object_['TESTTBL1'];
oMyObj2 :=oRep.Object_['TESTTBL2'];
oExp := CreateComObject(CLASS_Export) as IExport;
oExp.add(oMyObj1, 0);
oExp.add(oMyObj2, 0);
oExp.Export('c:/temp/myXmlFile.xml', 0);
oMyObj1:=nil;
oMyObj2:=nil;
oRoot:=nil;
oRep:=nil;
oExp:=nil;
参考:Sql Server的帮助项Export xml中的example