Автор: vkramnik
Дата сообщения: 15.07.2011 07:24
shaman1980
Коллега, вот рабочий пример вставки записи о клиенте в одну из моих FB-баз :
Код:
void __fastcall TDMPrihRash::DMClientsAdd (
AnsiString zFIO, // Clients_FIO
AnsiString zLevel, // Clients_Level
AnsiString zIDB, // Clients_IDB
AnsiString zContr, // Clients_Contract
AnsiString zDate, // Clients_Date
AnsiString zPhone, // Clients_Phone
AnsiString zDDate, // Clients_DiscDate
AnsiString zDBase, // Clients_DiscBase
AnsiString zComm // Clients_Comment
)
{
AnsiString txtInsClientsSQL = "INSERT INTO\n"
"CLIENTS\n"
" (\n"
" CLIENTS_FIO,\n"
" CLIENTS_LEVEL,\n"
" CLIENTS_IDB,\n"
" CLIENTS_CONTRACT,\n"
" CLIENTS_DATE,\n"
" CLIENTS_PHONE,\n"
" CLIENTS_DISCDATE,\n"
" CLIENTS_DISCBASE,\n"
" CLIENTS_COMMENT\n"
" )\n"
"VALUES\n"
"(\n" ;
zFIO = "\'" + zFIO + "\',\n" ; // Clients_FIO
zLevel = zLevel + ",\n" ; // Clients_Level
zIDB = zIDB + ",\n" ; // Clients_IDB
zContr = zContr + ",\n" ; // Clients_Contract
zDate = "\'" + zDate + "\',\n" ; // Clients_Date
zPhone = "\'" + zPhone + "\',\n" ; // Clients_Phone
zDDate = "\'" + zDDate + "\',\n" ; // Clients_DiscDate
zDBase = zDBase + ",\n" ; // Clients_DiscBase
zComm = "\'" + zComm + "\'\n" ; // Clients_Comment
txtInsClientsSQL += zFIO + zLevel + zIDB + zContr + zDate
+ zPhone + zDDate + zDBase + zComm + ")" ;
//*** ShowMessage( txtInsClientsSQL );
pFIBQueryClientsAdd->BeginModifySQLText();
pFIBQueryClientsAdd->SQL->Text = txtInsClientsSQL ;
pFIBQueryClientsAdd->EndModifySQLText();
pFIBQueryClientsAdd->ExecQuery();
}