X
xeen
Unregistered / Unconfirmed
GUEST, unregistred user!
为什么参数传递不正确,请看下列代码:
var
v:OleVariant;
str:OleVariant;
begin
str := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/2002.mdb;Persist Security Info=False';
v := CreateOleObject('ADOX.Catalog');
v.ActiveConnection := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/2002.mdb;Persist Security Info=False'; [blue]//执行正确[/blue]
v.ActiveConnection := str; [red]//运行期错误! [/red]
end;
看起来两种方法没区别啊,到底原因何在哪?
var
v:OleVariant;
str:OleVariant;
begin
str := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/2002.mdb;Persist Security Info=False';
v := CreateOleObject('ADOX.Catalog');
v.ActiveConnection := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/2002.mdb;Persist Security Info=False'; [blue]//执行正确[/blue]
v.ActiveConnection := str; [red]//运行期错误! [/red]
end;
看起来两种方法没区别啊,到底原因何在哪?