CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2012
    Posts
    16

    [RESOLVED] Help! combobox+mysql

    Hello,
    I try to make a DBManager gui for testing mysql in vs2010 but have problen wn try to refresh the combobox or clear the combobox bcz is filled w mysql_query.

    //-------------------------------------INITDIALOG---IS OK show databases

    mysql_query (&mysql,"SHOW DATABASES");
    if (res = mysql_store_result(&mysql))
    {
    max_fld = (int) mysql_num_fields(res);
    while (row = mysql_fetch_row(res))
    for(int i = 0; i < max_fld; i++)
    {
    SendDlgItemMessage(hwnd, ID_DBM_DEFAULTDB, CB_ADDSTRING, 0, (LPARAM)row[i]);
    }
    }else{
    MessageBox (hwnd,mysql_error(&mysql),"ERROR", MB_OK | MB_ICONERROR);
    mysql_free_result(res);
    }

    //----------------------------BUT COMMAND When I use drop databases not refresh or clear or update to show dbs i dont know how to that xD

    GetDlgItemText(hwnd,ID_DBM_DEFAULTDB,my_del_db,80);
    sprintf_s(my_del_query,"DROP DATABASE %s", my_del_db);

    if (!mysql_query(&mysql,my_del_query))
    {
    sprintf_s(my_del_msg,"Deleted Database: %s", my_del_db);
    MessageBox (hwnd,my_del_msg,"Delete.", MB_OK | MB_ICONINFORMATION);
    }/*(HERE UPDATE THE COMBOBOX)*/

    //-----Here I try to paste same code from initdlg but show dual databases
    //-----sorry my language im from venezuela ^^ im new programmer.

    tkns 4 help.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Help! combobox+mysql

    Quote Originally Posted by v_nom70 View Post
    ... have problen wn try to refresh the combobox or clear the combobox bcz is filled w mysql_query
    ....
    //-----sorry my language im from venezuela ^^ im new programmer.

    tkns 4 help.
    Could you translate what you wrote to some more understandable language?
    Sure what you wrote it's not in Spanish! But in what language is it supposed to be?
    Besides, when I was in Venezuela I never saw that someone begins a sentence with a small letter. The same is for country names!

    PS: please, use Code tags while posting code snippets. Otherwise it is very hard to read/understand. Check out Announcement: Before you post....
    Victor Nijegorodov

  3. #3
    Join Date
    May 2012
    Posts
    16

    Re: Help! combobox+mysql

    Quote Originally Posted by VictorN View Post
    Could you translate what you wrote to some more understandable language?
    Sure what you wrote it's not in Spanish! But in what language is it supposed to be?
    Besides, when I was in Venezuela I never saw that someone begins a sentence with a small letter. The same is for country names!

    PS: please, use Code tags while posting code snippets. Otherwise it is very hard to read/understand. Check out Announcement: Before you post....
    Ok my mistake, how I can edit the post;

    I have problem when I try to refresh my combobox because it is filled with mysql_query fields.

    thanks for the help

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Help! combobox+mysql

    Quote Originally Posted by v_nom70 View Post
    Ok my mistake, how I can edit the post;
    You'll be able to edit after about 5 posts.


    Quote Originally Posted by v_nom70 View Post
    I have problem when I try to refresh my combobox because it is filled with mysql_query fields.
    Quote Originally Posted by v_nom70 View Post
    BUT COMMAND When I use drop databases not refresh or clear or update to show dbs i dont know how to that xD
    I'm not sure I understand what you meant... however if you only want to remove all "old" items from the combobox - use CB_RESETCONTENT message.
    Victor Nijegorodov

  5. #5
    Join Date
    May 2012
    Posts
    16

    Re: Help! combobox+mysql

    Quote Originally Posted by VictorN View Post
    -use CB_RESETCONTENT message.
    SendMessage(hwnd, CB_RESETCONTENT, 0, 0);

    Thank you very much works for me, you are great.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: [RESOLVED] Help! combobox+mysql

    You are welcome!
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured