Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Debug Assertion

Debug Assertion

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasemysqlsysadmindebugging
16 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C CPallini

    See if this [^] helps. :)

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
    [My articles]

    D Offline
    D Offline
    Davitor
    wrote on last edited by
    #7

    Hi CPallini Thanks for reply.may i know where is concept of my question in your post?Plz help me

    C 1 Reply Last reply
    0
    • D Davitor

      Hi CPallini Thanks for reply.may i know where is concept of my question in your post?Plz help me

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #8

      It looks like you've to change the flag "Ignore # in table name" in your ODBC driver in order to make the statement 'SHOW DATABASES' work. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      D 1 Reply Last reply
      0
      • C CPallini

        It looks like you've to change the flag "Ignore # in table name" in your ODBC driver in order to make the statement 'SHOW DATABASES' work. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        D Offline
        D Offline
        Davitor
        wrote on last edited by
        #9

        So i change

        CString szSql = "SHOW DATABASES"; to this
        szSql = "SHOW DATABASES from mysql",

        or

        rs.Open( CRecordset::forwardOnly, szSql); to this
        rs.Open( _T("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=;User=root; Password=root;Option=3;"),szSql,CRecordset::forwardOnly);

        Both are givesame debug assertion. Plz help me

        1 Reply Last reply
        0
        • D Davitor

          Hi All I am geting debug assertion failed Line 3232 in file dbcore.cpp.Code is here

          Database database;
          try
          {
          if(database.OpenEx(_T("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=;User=root; Password=root;Option=3;"), CDatabase::noOdbcDialog))
          {
          AfxMessageBox("Connection Successfully");

          		CString szSql = "SHOW DATABASES";
          

          CRecordset rs(&database);
          rs.Open( CRecordset::forwardOnly, szSql);

          while (!rs.IsEOF())
          {
          CString szBuf;

          rs.GetFieldValue("DATABASE", szBuf);

          rs.MoveNext();
          }

          rs.Close();

          	}
          }
          catch(CException \*e)
          {
          AfxMessageBox("Connection Failed");	
          }
          

          i am geting assertion in this line

          rs.Open( CRecordset::forwardOnly, szSql);
          Debug assertion failed Line 3232 in file dbcore.cpp.

          I see line 3232 in dbcore.cpp file.There i found this syntax

          ASSERT(m_nFields != 0);

          Can any one tell how can i solve that debug assertion. Plz help me

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #10

          Ummmmm - "SHOW DATABASES" isn't SQL? It IS a MySQL command - but that doesn't necessarily make it something you can execute using ODBC?

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          D 1 Reply Last reply
          0
          • S Stuart Dootson

            Ummmmm - "SHOW DATABASES" isn't SQL? It IS a MySQL command - but that doesn't necessarily make it something you can execute using ODBC?

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            D Offline
            D Offline
            Davitor
            wrote on last edited by
            #11

            yaa i know "SHOW DATABASE" is Mysql command and i am useing for MySql.Can you tell how and which command is execute for SHOW DATABASE useing ODBC? Plz help me

            C S 2 Replies Last reply
            0
            • D Davitor

              yaa i know "SHOW DATABASE" is Mysql command and i am useing for MySql.Can you tell how and which command is execute for SHOW DATABASE useing ODBC? Plz help me

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #12

              You may try 'SHOW SCHEMA', it looks like more 'SQL standard'. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              1 Reply Last reply
              0
              • D Davitor

                yaa i know "SHOW DATABASE" is Mysql command and i am useing for MySql.Can you tell how and which command is execute for SHOW DATABASE useing ODBC? Plz help me

                S Offline
                S Offline
                Stuart Dootson
                wrote on last edited by
                #13

                Don't think you can use CRecordset - I don't think it lets you execute arbitrary commands. You could use CDatabase::ExecuteSQL - but that doesn't return any results. You can use ODBC to execute that command - here's how you'd do it in Python

                import dbi
                import odbc
                conn = odbc.odbc("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;")
                curs = conn.cursor()
                curs.execute("SHOW DATABASES")
                curs.fetchall()

                results in something like this

                [('information_schema',), ('mysql',), ('test',)]

                Here's how you could do it in C++ with ADO:

                #import "libid:2A75196C-D9EB-4129-B803-931327F72D5C" rename("EOF", "adoEOF")

                int main()
                {
                CoInitialize(0);
                ADODB::_ConnectionPtr conn(__uuidof(ADODB::Connection));
                conn->Open(_bstr_t("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;"), "", "", 0);
                ADODB::_RecordsetPtr rs = conn->Execute(_bstr_t("SHOW DATABASES"), 0, ADODB::adCmdText);

                _variant_t databaseNames = rs->GetRows(ADODB::adGetRowsRest);
                }

                databaseNames is a SAFEARRAY containing BSTR elements, one for each database name.


                Last modified: 3hrs 14mins after originally posted --

                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                D 2 Replies Last reply
                0
                • S Stuart Dootson

                  Don't think you can use CRecordset - I don't think it lets you execute arbitrary commands. You could use CDatabase::ExecuteSQL - but that doesn't return any results. You can use ODBC to execute that command - here's how you'd do it in Python

                  import dbi
                  import odbc
                  conn = odbc.odbc("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;")
                  curs = conn.cursor()
                  curs.execute("SHOW DATABASES")
                  curs.fetchall()

                  results in something like this

                  [('information_schema',), ('mysql',), ('test',)]

                  Here's how you could do it in C++ with ADO:

                  #import "libid:2A75196C-D9EB-4129-B803-931327F72D5C" rename("EOF", "adoEOF")

                  int main()
                  {
                  CoInitialize(0);
                  ADODB::_ConnectionPtr conn(__uuidof(ADODB::Connection));
                  conn->Open(_bstr_t("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;"), "", "", 0);
                  ADODB::_RecordsetPtr rs = conn->Execute(_bstr_t("SHOW DATABASES"), 0, ADODB::adCmdText);

                  _variant_t databaseNames = rs->GetRows(ADODB::adGetRowsRest);
                  }

                  databaseNames is a SAFEARRAY containing BSTR elements, one for each database name.


                  Last modified: 3hrs 14mins after originally posted --

                  Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                  D Offline
                  D Offline
                  Davitor
                  wrote on last edited by
                  #14

                  Thanks

                  1 Reply Last reply
                  0
                  • S Stuart Dootson

                    Don't think you can use CRecordset - I don't think it lets you execute arbitrary commands. You could use CDatabase::ExecuteSQL - but that doesn't return any results. You can use ODBC to execute that command - here's how you'd do it in Python

                    import dbi
                    import odbc
                    conn = odbc.odbc("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;")
                    curs = conn.cursor()
                    curs.execute("SHOW DATABASES")
                    curs.fetchall()

                    results in something like this

                    [('information_schema',), ('mysql',), ('test',)]

                    Here's how you could do it in C++ with ADO:

                    #import "libid:2A75196C-D9EB-4129-B803-931327F72D5C" rename("EOF", "adoEOF")

                    int main()
                    {
                    CoInitialize(0);
                    ADODB::_ConnectionPtr conn(__uuidof(ADODB::Connection));
                    conn->Open(_bstr_t("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;"), "", "", 0);
                    ADODB::_RecordsetPtr rs = conn->Execute(_bstr_t("SHOW DATABASES"), 0, ADODB::adCmdText);

                    _variant_t databaseNames = rs->GetRows(ADODB::adGetRowsRest);
                    }

                    databaseNames is a SAFEARRAY containing BSTR elements, one for each database name.


                    Last modified: 3hrs 14mins after originally posted --

                    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                    D Offline
                    D Offline
                    Davitor
                    wrote on last edited by
                    #15

                    Hi Stuart Dootson This things is working fine.But i need to use "Select * from Tablename".Show how can i get full information of table in

                    _variant_t.

                    Plz help me

                    S 1 Reply Last reply
                    0
                    • D Davitor

                      Hi Stuart Dootson This things is working fine.But i need to use "Select * from Tablename".Show how can i get full information of table in

                      _variant_t.

                      Plz help me

                      S Offline
                      S Offline
                      Stuart Dootson
                      wrote on last edited by
                      #16

                      It's not too difficult to find[^] appropriate examples[^] on t'Internet.

                      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups