Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Connection Azure


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Oct 16, 2016 12:04 PM Last Post By: Andrew McIsaac
Andrew McIsaac

Posts: 93
Registered: 3/12/13
Connection Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 6, 2016 11:39 PM
Good evening everyone,

I am currently building an application that will need to connect to "the cloud" database.
I have created a server, table in MS Azure.
I can connect to, and modify the table with the MS SQL Server Management Studio.

Does anyone know how to access this through C++ components / or documentation for ?
Would like to use FDConnection, but unable to so far.
Other possibilities Azure Connection, but unable to find examples

Thanks in advance,
Andrew
Andrew McIsaac

Posts: 93
Registered: 3/12/13
Re: Connection Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 7, 2016 12:41 AM   in response to: Andrew McIsaac in response to: Andrew McIsaac
Using Windows 10, and XE8 Enterprise.

Components :
FDConnection1,
FDQuery1,
FDGUIxWaitCursor1
three buttons, 1 to connect, 1 to disconnect, 1 to do query.
Label1

What I've done so far :
FD Connection1 :
• ConnectionName IDMC_Azure
• DriverName MSSQL
•Params : Address : [my database name.database.windows.net - as created within the Azure ...]
•Params : Database : [database name]
•Params : DriverID : MSSQL
•Password : [mypassword]
•Server [my server - as created within the Azure ...]
• UserName : [my_user_name]

void __fastcall TForm1::Button1Click(TObject *Sender)
{
FDConnection1->Connected = true;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
FDConnection1->Connected = false;

}

void __fastcall TForm1::Button3Click(TObject *Sender)
{

FDConnection1->Connected = true;
FDQuery1->Active=false;
FDQuery1->SQL->Clear();
FDQuery1->SQL->Add("Select * FROM [mytable]");
FDQuery1->Active=true;
FDQuery1->Open();
FDQuery1->First();
Label1->Text=FDQuery1->FieldByName("[field_name]")->AsString;
FDQuery1->Active=false;
FDConnection1->Connected = false;
}

// just to be safe ...
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if(FDConnection1->Connected == true)
FDConnection1->Connected = false;

}

This works well with VCL.

Connection with VCL is working fantastically, but when created as Multi-Device, Works, until I close the Form, then I get a access violation at 0x... read of address 0x... ( but not always )
The intention is to be able to go to mobile devices as well, so it would be preferable if could do Multi-device.

Any ideas ?
Thanks,

Andrew McIsaac

Posts: 93
Registered: 3/12/13
Re: Connection Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 12, 2016 9:13 PM   in response to: Andrew McIsaac in response to: Andrew McIsaac
If I create a form - and add a FDConnection, and a FDQuery to a Multidevice Project, ( with out the TFDGUIxWaitCursor, and don't run a query, form will close OK,
If I Add the TFDGUIxWaitCursor as needed, run the query, I get the correct data from the Azure table, but the Form creates the Error when closing program.

Any ideas ?
Thanks
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Connection Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2016 10:19 PM   in response to: Andrew McIsaac in response to: Andrew McIsaac
... but the Form creates the Error when closing program.

What exactly is the error ?

--
With best regards,
Dmitry
Andrew McIsaac

Posts: 93
Registered: 3/12/13
Re: Connection Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 16, 2016 12:04 PM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
VCL With Connection Properties defined in the Properties fields of FDConnection1 : login Prompt set to True, changed to false, and FDGUIxWaitCursor1 Provider was not Set to FMX. Changed to FMX and all is good.

Thanks you to everyone who was helping.

Andrew
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02