// TSQLDataSet = SQL // dla jasności
AnsiString insert= "INSERT INTO dystrybutor SET dystrybutor='";
insert += Form1->CBDys->Text;
insert += "'";
Form1->SQL->CommandText = insert;
if(Form1->SQL->ExecSQL(True) == 1)
{
ShowMessage("Nowy dystrybutor został dodany!");
}
AnsiString odczyt;
SQL->CommandText = "SELECT * FROM dystrybutor WHERE id='15'";
odczyt = SQL->FieldValues["dystrybutor"];
SQL->ExecSQL(True);
SQL->CommandText = "SELECT * FROM dystrybutor WHERE id='15'";
SQL->Open();
SQLQ->CommandText = "SELECT spr FROM dystrybutor WHERE id='18'";
SQLQ->Open();
AnsiString odczyt = "";
odczyt = SQLQ->FieldValues["spr"];
ShowMessage(odczyt);
SQLQ->CommandText = "SELECT * FROM dystrybutor WHERE id='18'";
SQLQ->CommandText = "SELECT spr, dystrybutor FROM dystrybutor WHERE id='18'";
SQLQ->CommandText = "SELECT dystrybutor FROM dystrybutor WHERE id='20'";
SQLQ->Open();
AnsiString odczyt = "";
odczyt = SQLQ->FieldByName("dystrybutor");
odczyt = SQLQ->FieldByName("dystrybutor")->AsString;
SDS->DataSet->CommandText = "SELECT dystrybutor FROM dystrybutor";
SDS->Open();
// SDS->FieldValues["dystrybutor"];
TSQLConnection* conn = new TSQLConnection(0);
conn->ConnectionName = "MySQLConnection";
conn->DriverName = "MySQL";
conn->GetDriverFunc = "getSQLDriverMYSQL";
conn->LibraryName = "dbxmys.dll";
conn->VendorLib = "libmysql.dll";
conn->LoginPrompt = false;
conn->Params->Values["User_Name"] = "xxx";
conn->Params->Values["Database"] = "yyy";
conn->Params->Values["Password"] = "zzz";
conn->Params->Values["HostName"] = "127.0.0.1";
TSQLQuery* query = new TSQLQuery(0);
query->SQLConnection = conn;
query->CommandText = "select * from xyz";
query->Open();
if(!query->IsEmpty())
{
for(int i(0); i < query->RecordCount; ++i)
{
ShowMessage(query->FieldByName("imie")->AsString + ' ' + query->FieldByName("nazwisko")->AsString);
query->Next();
}
query->Close();
}
conn->Close();
TSQLConnection* conn = new TSQLConnection(0);
conn->ConnectionName = "MySQLConnection";
conn->DriverName = "MySQL";
conn->GetDriverFunc = "getSQLDriverMYSQL";
conn->LibraryName = "dbxmys.dll";
conn->VendorLib = "libmysql.dll";
conn->LoginPrompt = false;
conn->Params->Values["User_Name"] = "zzz";
conn->Params->Values["Database"] = "yyy";
conn->Params->Values["Password"] = "zzz";
conn->Params->Values["HostName"] = "127.0.0.1";
TSimpleDataSet* data_set = new TSimpleDataSet(0);
data_set->Connection = conn;
data_set->DataSet->CommandType = ctQuery;
data_set->DataSet->CommandText = "select * from xyz";
data_set->Open();
TDataSource* data_source = new TDataSource(0);
if(!data_set->IsEmpty())
{
data_source->DataSet = data_set;
GRID->DataSource = data_source;
}
conn->LibraryName = "dbxmys.dll";
Użytkownicy przeglądający ten dział: Brak zalogowanych użytkowników i 0 gości