我在数据库连接设置模块中引用了sqldmo_tlb单元~~~主要是用来获取局域网内所有PC的SQL数据库
可是不知为什么 application. 不能用了,程序运行时老是报错,没有定义类或对象~~
有哪位大哥知道怎么回事么~??谢谢~!!
可是不知为什么 application. 不能用了,程序运行时老是报错,没有定义类或对象~~
有哪位大哥知道怎么回事么~??谢谢~!!
解决方案 »
- 关于delphi7如何解决idtcpserver 的CurrentReadBuffer的阻塞问题
- 有谁能做一个象MSSQL 中创建视图那样的拖拽后建立对应关系并画线的控件,或第三方控件也行,先给50分,解决后再给100‘
- treeview多选时怎么得到所选节点的StateIndex??
- 如何模拟windows粘贴操作(在线)
- 请问:如何得到当前paintbox的(0,0)和(width,height)像素在所显示的图片中的实际位置
- 高手们指教:集团应用的报表怎么设计,提提意见!
- 各位前辈,能给介绍几本学习delphi的好书吗??
- 大家帮我看看这句SQL命令什么地方出错了
- ComboBox不支持Ctrl+V?
- 如何设置dbgrid网格控件的列宽?
- 祝【懵懵】生日快乐,放分200,哈
- 内存增长
[Error] E_database.pas(118): Object or class type required
procedure TE_databasef.ComboBox2DropDown(Sender: TObject);
var
icount,Server_B:integer;
begin
combobox2.Items.Clear;
Screen.Cursor:=CrHourGlass;
Server_B:=combobox1.Items.IndexOf(combobox1.Text);
with PdmoObject[Server_B].SQL_DMO do
begin
if not PdmoObject[Server_B].lConnected then
try
Connect(Name,Trim(combobox3.Text),Trim(edit1.Text));
except
Screen.Cursor:=CrDefault;
Application.MessageBox('请检查用户名或密码是否正确','连接失败',MB_OK);//报错[Error] E_database.pas(202): Undeclared identifier: 'MessageBox'
Exit;
end;
if not VerifyConnection(SQLDMOConn_ReconnectIfDead) then
begin
ShowMessage('在试图连接到SQL SERVER 2000 时出现错误'+#10#13 +'确信是否加在了动态连接库SQLDMO.DLL');
exit;
end
else
PdmoObject[Server_B].lConnected:=True;
Databases.Refresh(true);
for icount:=1 to Databases.Count do
combobox2.Items.Add(Databases.Item(icount,null).name);
end;
Screen.Cursor:=CrDefault;
end ;
//这是错误是需要对象或类类型
///
把E_database.pas的118行附近代码贴出来
var addsini:tinifile;
s:string;
begin
try
begin
if checkbox1.Checked then
s:='Provider=SQLOLEDB.1;'+
'Integrated Security=SSPI;Persist Security Info=False;'+
'Initial Catalog='+combobox2.Text+';Data Source='+combobox1.Text+''
else
s:='Provider=SQLOLEDB.1;'+
'Password='+edit1.Text+';'+
'Persist Security Info=False;'+
'User ID='+combobox3.Text+';'+
'Initial Catalog='+combobox2.Text+';'+
'Data Source='+combobox1.Text+';'+
'Use Procedure for Prepare=1;'+
'Auto Translate=True;'+
'Packet Size=4096;'+
'Workstation ID=hx05;'+
'Use Encryption for Data=False;'+
'Tag with column collation when possible=False';
end;
datamodule1.ADOConnection1.Connected:=false;
datamodule1.ADOConnection1.ConnectionString:=s;
datamodule1.ADOConnection1.Connected:=true;
if datamodule1.ADOConnection1.Connected then
begin
if (combobox1.Text='') or (combobox2.Text='') or (combobox3.Text='') then
i:=messagebox(handle,'数据连接必须值不能为空','警告',mb_iconwarning+mb_ok);
i:=messagebox(handle,'确认要更改连接吗?各个数据库中的表并不相同,更改连接后有可能导致数据库连接失败!','警告',mb_yesno+mb_iconwarning);
if i=idno then
abort
else
begin
addsini:=Tinifile.Create(extractfilepath(application.exename)+'login.ini');//错误[Error] E_database.pas(119): Object or class type required
addsini.WriteString('database','server',combobox1.Text);
addsini.WriteString('database','database',combobox2.Text);
addsini.WriteString('database','user',combobox3.Text);
addsini.WriteString('database','password',edit1.Text);
addsini.WriteBool('database','if_windows_login',checkbox1.checked);
close;
end;
end
else
except
application.MessageBox('数据库连接失败,请检查配置文件','连接错误',mb_iconstop+MB_OK);
//错误 [Error] E_database.pas(130): Object or class type required
end;end;
try
Connect(Name,Trim(combobox3.Text),Trim(edit1.Text));
except
Screen.Cursor:=CrDefault;
Application.MessageBox('请检查用户名或密码是否正确','连接失败',MB_OK);
//[Error] E_database.pas(202): Undeclared identifier: 'MessageBox'
Exit;
end;
e-mail: [email protected]