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.
#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=newchar[length + 1];
GetWindowText(textBox, query, length);
ExecuteQuery(query); //replace this line with whatever query execute function you use
break;
}
}
break;
}