procedure ConnectDatabase;
Const
ConnStr='Provider=%s;Password=%s;Persist Security Info=True;'+
'User ID=%s;Initial CataLog=%s;Data Source=%s';
begin
DataConn.Open;
//尝试连接数据库
Try
With DataConn Do
Begin
IF Connected Then Connected:=False;
ConnectionString:=Format(ConnStr,['SQLOLEDB.1','AAA','asdf','asdf','.']);
loginPromt:=False;
Open;
End;
Except
MessageBox(Handle,'请检测网络或数据库是否发生故障?','错误',MB_Ok OR Mb_IConInformation);
Application.Terminate;
End;
End;