Query regarding how to execute SQL like queries through windows application.

I am new to databases. I am creating an application for my final project.
My application (I use VS2010 C++, Windows form application) connects to MySql database in the backend. I have made a login form with username and password for entering into MySql database and got successfully executed the code.

Now, I want to try writing queries in that window; execute the query on clicking the 'Run' button in the tool-bar; and display that table data in my window.

It will be of great help if anyone could help me get through this.
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#define BUTTON_ID 1
HWND textBox=CreateWindow("EDIT" ...);
HWND button=CreateWindow("BUTTON" ... /* 9th Param: */ BUTTON_ID ...);

/*inside switch case of window procedure */
case WM_COMMAND:
{
  switch(wParam)
 {
    case BUTTON_ID:
    {
       int length=GetWindowTextLength(textBox);
       char* query=new char[length + 1];
       GetWindowText(textBox, query, length);
       ExecuteQuery(query);  //replace this line with whatever query execute function you use
       break;
    }
 }
 break;
}
Last edited on
Thanks. but that is c++ code. It is different from Visual studio's C++ code.
Topic archived. No new replies allowed.