ADOConnection1.Close;
ADOConnection1.ConnectionString := 'Provider=SQLOLEDB.1;Persist Security Info=True;User ID=' + UserId +
';Initial Catalog=' + DBName + ';Data Source=' + Serverip + ';';
ADOConnection1.Open(UserId, UserPass);
Try
Adoquery1.Connection:= ADOConnection1;
ADOQuery1.Close;
ADOQuery1.SQL.Clear
ADOQuery1.SQL.Add('Select * From student ');
ADOQuery1.Open;
Finally
End;