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. .NET (Core and Framework)
  4. procedure

procedure

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasehelpmysqlsysadminannouncement
17 Posts 6 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.
  • F frostcox

    ExecuteNonQurey should only be used for inserts, updates and deletes, if your preforming a select you should be saying ExecuteReader to return what ever you want, hope this helps, need any more help just ask.

    N Offline
    N Offline
    nitish_07
    wrote on last edited by
    #7

    OdbcCommand cmd;
    cmd = new OdbcCommand("abc", cn);
    cmd.CommandType = CommandType.StoredProcedure;
    OdbcDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
    string s = dr.GetString(0);
    }

    after doing this I am getting the same error after line cmd.commandtype=cmd.executereader... now what should i do..it says odbcexception was unhandled..

    L 1 Reply Last reply
    0
    • N nitish_07

      OdbcCommand cmd;
      cmd = new OdbcCommand("abc", cn);
      cmd.CommandType = CommandType.StoredProcedure;
      OdbcDataReader dr = cmd.ExecuteReader();
      while (dr.Read())
      {
      string s = dr.GetString(0);
      }

      after doing this I am getting the same error after line cmd.commandtype=cmd.executereader... now what should i do..it says odbcexception was unhandled..

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #8

      Like I said yesterday, the exception message is reasonably clear that there is a problem in your stored procedure abc(). If you cannot figure out what is wrong with it then post it here so an SQL expert can help.

      speaking as ...

      N 1 Reply Last reply
      0
      • L Lost User

        Like I said yesterday, the exception message is reasonably clear that there is a problem in your stored procedure abc(). If you cannot figure out what is wrong with it then post it here so an SQL expert can help.

        speaking as ...

        N Offline
        N Offline
        nitish_07
        wrote on last edited by
        #9

        Sir there is no problem with my stored procedure..It is working fine in database..when i call through c# it throws error...

        P 1 Reply Last reply
        0
        • N nitish_07

          Sir there is no problem with my stored procedure..It is working fine in database..when i call through c# it throws error...

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #10

          There's obviously some problem there. If you refuse to give us the full information we cannot help.

          *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

          CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

          N 1 Reply Last reply
          0
          • P Pete OHanlon

            There's obviously some problem there. If you refuse to give us the full information we cannot help.

            *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

            CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

            N Offline
            N Offline
            nitish_07
            wrote on last edited by
            #11

            This is my procedure abc..

            DELIMITER $$

            DROP PROCEDURE IF EXISTS `userdb`.`abc`$$
            CREATE DEFINER=`root`@`localhost` PROCEDURE `abc`()
            BEGIN
            select * from login;
            END$$

            DELIMITER ;

            L M 2 Replies Last reply
            0
            • N nitish_07

              This is my procedure abc..

              DELIMITER $$

              DROP PROCEDURE IF EXISTS `userdb`.`abc`$$
              CREATE DEFINER=`root`@`localhost` PROCEDURE `abc`()
              BEGIN
              select * from login;
              END$$

              DELIMITER ;

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #12

              This is an uneducated guess, based on a quick scan of this page[^], but are you sure you need the quotes around the procedure name in your CREATE statement?

              speaking as ...

              N 1 Reply Last reply
              0
              • L Lost User

                This is an uneducated guess, based on a quick scan of this page[^], but are you sure you need the quotes around the procedure name in your CREATE statement?

                speaking as ...

                N Offline
                N Offline
                nitish_07
                wrote on last edited by
                #13

                I had seen that from original mysql query browser...but as u said i deleted that ' ' from procedure name and then tried but found the same error...

                L 1 Reply Last reply
                0
                • N nitish_07

                  I had seen that from original mysql query browser...but as u said i deleted that ' ' from procedure name and then tried but found the same error...

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #14

                  Sorry, but as I said that was an uneducated guess, but your error message is definitely complaining about that line. You could start a new thread in the MySQL[^] forum, to see if any expert sees the question. I would suggest you post your C# code and your stored procedure and the full exact text of the error message.

                  speaking as ...

                  N 1 Reply Last reply
                  0
                  • L Lost User

                    Sorry, but as I said that was an uneducated guess, but your error message is definitely complaining about that line. You could start a new thread in the MySQL[^] forum, to see if any expert sees the question. I would suggest you post your C# code and your stored procedure and the full exact text of the error message.

                    speaking as ...

                    N Offline
                    N Offline
                    nitish_07
                    wrote on last edited by
                    #15

                    Sir I had already posted all the things in my post....

                    L 1 Reply Last reply
                    0
                    • N nitish_07

                      Sir I had already posted all the things in my post....

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #16

                      Well I don't think any of the MySQL experts are going to be looking here.

                      speaking as ...

                      1 Reply Last reply
                      0
                      • N nitish_07

                        This is my procedure abc..

                        DELIMITER $$

                        DROP PROCEDURE IF EXISTS `userdb`.`abc`$$
                        CREATE DEFINER=`root`@`localhost` PROCEDURE `abc`()
                        BEGIN
                        select * from login;
                        END$$

                        DELIMITER ;

                        M Offline
                        M Offline
                        Manfred Rudolf Bihy
                        wrote on last edited by
                        #17

                        You've explicitely changed the delimiter to $$, but terminated the select statement with a semicolon. Regards, Manfred

                        "With sufficient thrust, pigs fly just fine."

                        Ross Callon, The Twelve Networking Truths, RFC1925

                        "Der Berg ruft!"

                        Me, 2012-05-24

                        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