var
Form1: TForm1;
adoc : OleVariant;
ador: OleVariant;
const
adOpenStatic = 3;
adLockOptimistic = 2;
adCmdText = 0001;implementation{$R *.dfm}procedure TForm1.btnLoginClick(Sender: TObject);
begin
try
adoc := CreateOleObject('ADODB.Connection');
adoc.Open('Provider=SQLOLEDB.1;Integrated Security='+
'SSPI;Persist Security Info=False;Initial Catalog='+
'Library_Management_System;Data Source=MASHENGHE');
MessageBox(Handle,'连接成功','提示',MB_OK or MB_ICONINFORMATION);
except
MessageBox(Handle,'连接出错','错误',MB_OK or MB_ICONERROR);
end;
end;procedure TForm1.btnExitClick(Sender: TObject);
begin
ador :=CreateOleObject('ADODB.RecrodSet');
ador.ActiveConnection := adoc;
ador.Open('SELECT * FROM Students',adoc,adOpenStatic,adLockOptimistic, adCmdText);
fillData;
end;procedure TForm1.fillData;
begin
///
end;
请帮忙看看,这段代码出什么问题了提示 无效类别字符串 帮帮改改 谢谢!
Form1: TForm1;
adoc : OleVariant;
ador: OleVariant;
const
adOpenStatic = 3;
adLockOptimistic = 2;
adCmdText = 0001;implementation{$R *.dfm}procedure TForm1.btnLoginClick(Sender: TObject);
begin
try
adoc := CreateOleObject('ADODB.Connection');
adoc.Open('Provider=SQLOLEDB.1;Integrated Security='+
'SSPI;Persist Security Info=False;Initial Catalog='+
'Library_Management_System;Data Source=MASHENGHE');
MessageBox(Handle,'连接成功','提示',MB_OK or MB_ICONINFORMATION);
except
MessageBox(Handle,'连接出错','错误',MB_OK or MB_ICONERROR);
end;
end;procedure TForm1.btnExitClick(Sender: TObject);
begin
ador :=CreateOleObject('ADODB.RecrodSet');
ador.ActiveConnection := adoc;
ador.Open('SELECT * FROM Students',adoc,adOpenStatic,adLockOptimistic, adCmdText);
fillData;
end;procedure TForm1.fillData;
begin
///
end;
请帮忙看看,这段代码出什么问题了提示 无效类别字符串 帮帮改改 谢谢!
Form1: TForm1;
adoc : OleVariant;
ador: OleVariant;
改成
var
Form1: TForm1;
adoc : Variant;
ador: Variant;
还是同样的错误用了uses comobj请帮帮呀...