#include#pragma hdrstop #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { }
void __fastcall TForm1::FormCreate(TObject *Sender) { Canvas->Pen->Width = 3; Canvas->Pen->Color = clBlue; Canvas->Brush->Color = clYellow; Canvas->Ellipse(10, 10, 100, 100); }
#includeThis code example demonstrates accessing a MySQL database using the MySQL C API library. Package libraries used in this example are VCL and MySQL C API.#include #include #include "mysql.h" #pragma hdrstop #pragma package(smart_init) using namespace std; int main() { MYSQL* conn; MYSQL_RES* res; MYSQL_ROW row; conn = mysql_init(0); conn = mysql_real_connect(conn, "localhost", "root", "", "testdb", 3306, NULL, 0); if (conn) { cout << "Database connection established" << endl; mysql_query(conn, "SELECT * FROM customers"); res = mysql_store_result(conn); while (row = mysql_fetch_row(res)) { for (int i = 0; i < mysql_num_fields(res); i++) { cout << row[i] << "\t"; } cout << endl; } mysql_free_result(res); } else { cout << "Failed to connect to database" << endl; } mysql_close(conn); return 0; }