Delphi 6(1)

序言

 

 For

uses
  SysUtils;

  var i:integer;
begin

  for i:=1 to 10 do
   begin
    Writeln(i);
   end;
  Readln;
end.

Delphi用字符串连接MSSQLERVER

控制台连接Sql Server数据库

uses
 ADOdb,ActiveX;

var
 conMain : TADOConnection;
 tab1 : TADOTable;

begin
 CoInitialize(nil);
 conMain := TADOConnection.Create(nil);
 tab1 := TADOTable.Create(nil);

 conMain.ConnectionString := 'Provider=SQLOLEDB.1;Password=xx;Persist Security Info=True;User ID=sa;Initial Catalog=xx;Data Source=127.0.0.1';
 conMain.LoginPrompt := False;
 conMain.Open;

 tab1.Connection := conMain;
 tab1.TableName := 'CASTAFF';
 tab1.Active := True;
 tab1.Recordset.MoveFirst;
 while not tab1.Recordset.EOF do
 begin
   writeln(tab1.Recordset.Fields[2].Value);
   tab1.Recordset.MoveNext;
 end;

 CoUninitialize;
 Readln;
end.
View Code

TADOConnection

资料

Delphi 数据库查询(TADOQuery)

https://blog.51cto.com/mslagee/558806

https://www.ixigua.com/6773433817253282315?id=6772498388131774980&logTag=9e852d7bd255becbcf5b

posted @ 2021-11-27 11:49  ~沐风  阅读(46)  评论(0编辑  收藏  举报