现有源码如下:
var
Form1: TForm1;
con,rs:variant;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
con:=createoleobject('adodb.connection');
rs:=createoleobject('adodb.recordset');
con.open('provider=msdasql;uid=sa;pwd=;data source=bar');
self.ADOTable1.ConnectionString:='provider=msdasql;uid=sa;pwd=;data source=bar';
self.ADOTable1.TableName:='menu';
self.adoTable1.open;
end;
编译时提示错误:
Project Project1.exe raised exception class EVariantError with message 'Invaild variant type conversion'.Process stopped. Use Step or Run to continue.
但再次编译能运行
请各位大虾高手指点!!!
先谢了!!!!!!!
var
Form1: TForm1;
con,rs:variant;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
con:=createoleobject('adodb.connection');
rs:=createoleobject('adodb.recordset');
con.open('provider=msdasql;uid=sa;pwd=;data source=bar');
self.ADOTable1.ConnectionString:='provider=msdasql;uid=sa;pwd=;data source=bar';
self.ADOTable1.TableName:='menu';
self.adoTable1.open;
end;
编译时提示错误:
Project Project1.exe raised exception class EVariantError with message 'Invaild variant type conversion'.Process stopped. Use Step or Run to continue.
但再次编译能运行
请各位大虾高手指点!!!
先谢了!!!!!!!
解决方案 »
- 求教:如何处理对数据库插入记录时,主键重复插入报错的问题?
- 用InstallShield Professional 6.22做安装程序出现"iKernel.exe"出错问题,在线等待
- 哪位遇到过speedbutton放在toolbar上,凹凸的问题?
- 李维的《最新DELPHI7数据库高级设计》EBook哪里有下载?
- 代码问题,帮我看看(在线等候)
- 如何在Delphi中实现不让用户在组合框中输入字符?如何让用户只能输入一个字母或汉字。
- customeredit1.pas(163): Identifier redeclared: 'Tcustomeredit.BitBtn4Click'
- 关于自定义类在Create后(时)的属性赋值顺序问题
- append时出错?''is not a valid integer value
- 在编写多层数据管理系统中要什么样的数据库才好呢?送分了!!!!
- 谁知道,Delphi在关于报表打印方面有没有比较全面的资料
- 如何获取shellexcute的输出结果?
'Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=bar'原来的ConnectionString:
'provider=msdasql;uid=sa;pwd=;data source=bar'
self.ADOTable1.ConnectionString:='provider=msdasql;uid=sa;pwd=;data source=bar';
self.ADOTable1.TableName:='menu';
self.adoTable1.open;
按你说的还是原来的错误,
对我的两个ConnectionString 的比较有何看法?
那为什么我用delphi自己生成的ConnectionString 又没问题???