C++ example
C++ example
Looking for a sample program in c++. tired to convert delphi samples but keep getting errors. I'm looking to create the object from the code
-
Stefan Padlo
- Posts: 5
- Joined: Wed 23 Mar 2011 23:02
You have to be more precise...
But I'll give U some of my example code.
Let's say, that somewhere in Your form there's established TUniConnection object. Otherwise, you have to put some #pragma link ".obj" - it depends on the type of provider, create new object and Connect().
for example
Dynamic - query:
Hope it will help You a lil'.
Cheers,
Stefan
But I'll give U some of my example code.
Let's say, that somewhere in Your form there's established TUniConnection object. Otherwise, you have to put some #pragma link ".obj" - it depends on the type of provider, create new object and Connect().
for example
Code: Select all
TUniConnection *con;Code: Select all
void __fastcall myForm::myFunc(void)
{
TUniQuery *q = new TUniQuery(NULL);
q->Connection = con; // important thing ;)
q->SQL->Text = "SELECT * FROM example_table;";
q->Open();
// do your stuff, for example:
ShowMessage(q->FieldByName("your_field")->AsString);
delete q; // always remember to free this object if U have finished
}
Cheers,
Stefan