C
corely
Unregistered / Unconfirmed
GUEST, unregistred user!
function GetSysId(TableName: pChar): integer;
var
ADOQuery: TADOQuery;
ADOConnection:TADOConnection;
begin
try
ADOConnection := TADOConnection.Create(nil);
ADOQuery := TADOQuery.Create(nil);
except
showmessage('´´½¨²éѯ×é¼þʧ°Ü!');
ADOConnection.Free;
ADOQuery.Free;
Exit;
end;
try
ADOConnection.Connected := False;
ADOConnection.Close;
ADOConnection.ConnectionString := '';
ADOConnection.LoginPrompt := False;
ADOConnection.Connected := True;
ADOQuery.Close;
ADOQuery.SQL.Clear;
ADOQuery.SQL.Add('SELECT next_id FROM sysdata..sysid(NOLOCK) WHERE sysid_name = ''' + TableName + '''');
ADOQuery.Open;
Result := ADOQuery.Parameters[0].Value;
ADOConnection.Free;
ADOQuery.Free;
except
Exit;
end;
end;
以上要我的代码,但在编译时老是出现以下警告,怎么解决啊?
Variable 'ADOQuery' might not have been initialized
Variable 'ADOConnection' might not have been initialized
Return value of function 'GetSysId' might be undefined
var
ADOQuery: TADOQuery;
ADOConnection:TADOConnection;
begin
try
ADOConnection := TADOConnection.Create(nil);
ADOQuery := TADOQuery.Create(nil);
except
showmessage('´´½¨²éѯ×é¼þʧ°Ü!');
ADOConnection.Free;
ADOQuery.Free;
Exit;
end;
try
ADOConnection.Connected := False;
ADOConnection.Close;
ADOConnection.ConnectionString := '';
ADOConnection.LoginPrompt := False;
ADOConnection.Connected := True;
ADOQuery.Close;
ADOQuery.SQL.Clear;
ADOQuery.SQL.Add('SELECT next_id FROM sysdata..sysid(NOLOCK) WHERE sysid_name = ''' + TableName + '''');
ADOQuery.Open;
Result := ADOQuery.Parameters[0].Value;
ADOConnection.Free;
ADOQuery.Free;
except
Exit;
end;
end;
以上要我的代码,但在编译时老是出现以下警告,怎么解决啊?
Variable 'ADOQuery' might not have been initialized
Variable 'ADOConnection' might not have been initialized
Return value of function 'GetSysId' might be undefined