delphi ADO
5288 단어 Delphi
1) t_ADOConnection: TADOConnection;
2) iRet := KT_ConnectDB('','',clUseServer,cmReadWrite,t_ADOConnection,sErrMessage);
iRet := KT_SetTransaction('READ UNCOMMITTED',sErrMessage);
3)
/**
*
* Display
*/
lKTDataSet : TKtAdoDataset;
lt_ADOConnection : TAdoConnection;
try
if (KTAxesDB(lt_ADOConnection,lKTDataset) = ST_OK) then begin
lKTDataset.CommandText := sSql;
lKTDataset.KTFirstRead;
iT3019 := lKTDataset.FieldbyName('T3019');
lKTDataset.KTNext = ST_OK;
end
finally
KTCloseDB(lKTDataset);
end;
insert create delele update
lKTCommand : TKTADOCommand;
lt_ADOConnection : TAdoConnection;
if (KtCmndDB(lt_ADOConnection,lKTCommand) = ST_OK) then begin
KtCloseDB(lKTDataSet);
KtCloseCmndDB(lKTCommand);
//******************************************************************************
// KtADOExecute: コマンド
//******************************************************************************
Function KtADOExecute(COMMAND: TKTADOCommand; CONNECTION: TADOConnection;
COMMANDTYPE: TCommandType; COMMANDTEXT: String) : Integer;
begin
COMMAND.Connection := CONNECTION;
COMMAND.CommandType := COMMANDTYPE;
COMMAND.CommandText := COMMANDTEXT;
Result := COMMAND.KTExecute;
end;
//***********************************************************************
// module name : DB *
//----------------------------------------------------------------------*
// style : KTAxesDB *
//***********************************************************************
Function KTAxesDB(var t_ADOConnection: TAdoConnection; var KTDataset: TKtAdoDataset) : Integer;
var
iSt : Integer;
sErrMessage : String;
begin
Result := ST_OK;
KTDataSet := TKtAdoDataset.Create(NIL);
try
iSt := KT_ConnectDB('','',clUseServer,cmReadWrite,t_ADOConnection,sErrMessage);
if (iSt <> ST_OK) then begin
Err_Dsp(iSt,Get_Message('COMMON','0001')+#13#10+sErrMessage,NIL);
Result := iSt;
Exit;
end;
if (KTDataSet.Active = True) then KTDataSet.Active := False;
KTDataSet.Connection := t_ADOConnection;
KTDataSet.CommandType := cmdText ;
KTDataSet.CursorLocation := clUseServer ;
KTDataSet.LockType := ltOptimistic ;
finally
end;
end;
//***********************************************************************
// module name : DB *
//----------------------------------------------------------------------*
// style : KTCloseDB *
//***********************************************************************
Function KTCloseDB(var KTDataset: TKtAdoDataset) : Integer;
begin
Result := ST_OK;
if (KTDataSet.Active = True) then KTDataSet.Active := False;
KTDataSet.Connection := nil;
KTDataSet.Free;
end;
//******************************************************************************
// KTCmndDB : DB (ADOCommand)
//------------------------------------------------------------------------------
// CONNECTION : TADOConnection
// COMMAND : TKTADOCommand
// り : Integer
//******************************************************************************
Function KtCmndDB(var CONNECTION: TADOConnection; var COMMAND: TKTADOCOMMAND) : Integer;
var
iRet: Integer;
sErrMessage: String;
begin
Result := ST_OK;
COMMAND := TKTADOCommand.Create(NIL);
try
//Connection
iRet := KT_ConnectDB('','',clUseClient,cmReadWrite,CONNECTION,sErrMessage);
if (iRet <> ST_OK) then begin
Err_Dsp(iRet,Get_Message('COMMON','0001')+#13#10+sErrMessage,NIL); //サーバー に しました。
Result := iRet;
Exit;
end;
COMMAND.CommandTimeout := 0;
COMMAND.Connection := CONNECTION;
COMMAND.CommandType := cmdText;
finally
end;
end;
//******************************************************************************
// KTCloseCmndDB:DB (ADOCommand)
//------------------------------------------------------------------------------
// COMMAND : TKTADOCommand
// り : Integer
//******************************************************************************
Function KtCloseCmndDB(var COMMAND: TKTADOCommand) : Integer;
begin
Result := ST_OK;
COMMAND.Connection := nil;
COMMAND.Free;
end;
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[Delphi] TStringBuilder그리고 꼭 사용해야만 할까? 그림처럼 Heap 영역에 "Hello" 공간을 생성하고 포인팅을 한다. "Hello World" 공간을 새로 생성한 후 포인팅을 하게 된다. 결국 "Hello" 라는 String 객체가 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.