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. Database & SysAdmin
  3. Database
  4. mysql problem

mysql problem

Scheduled Pinned Locked Moved Database
helpdatabasemysqltutorial
12 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.
  • M mylogics

    hi am using stored procedure to submit a registration form. i have checked lot of time but get the same error can yuo plz guide me. Message = "Key cannot be null.\r\nParameter name: key"

    R Offline
    R Offline
    RaviRanjanKr
    wrote on last edited by
    #3

    mylogics wrote:

    i have checked lot of time but get the same error can yuo plz guide me.

    :confused: I am not getting your problem, please be clear about your question. Provide code which throws exception and what exception you are getting. we can justice with your question when you did first :)

    M 1 Reply Last reply
    0
    • R RaviRanjanKr

      mylogics wrote:

      i have checked lot of time but get the same error can yuo plz guide me.

      :confused: I am not getting your problem, please be clear about your question. Provide code which throws exception and what exception you are getting. we can justice with your question when you did first :)

      M Offline
      M Offline
      mylogics
      wrote on last edited by
      #4

      i have a stored procedure named insertreg: DELIMITER $$DROP PROCEDURE IF EXISTS `naukri4u`.`insertreg`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `insertreg`(emailaddress varchar(50),firstname varchar(50),lastname varchar(50),username varchar(50),password varchar(50),conformpassword varchar(50),mobile varchar(50),currentloc varchar(50),prefferedjobloc varchar(50),gender varchar(50),totalexp varchar(50),industry varchar(50),function varchar(50),keyskills varchar(50),highestqual varchar(50),yearofpass varchar(50),institute varchar(50),resumetitle varchar(50),resume varchar(50)) BEGIN insert into registration(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume) values(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume); END$$DELIMITER ; i want to submit a regisration form using this stored proc.this registration table have primary key reg_id which auto increments so i have not taken it in my query.the code i have written is:

      public DataSet insert(Common.com_registration objcom_reg)
      {
      registration reg = new registration();
      try
      {
      DbParameter dbparama0 = DAC.Parameter("emailaddress", objcom_reg.Emailaddress, DbType.String, ParameterDirection.Input);
      DbParameter dbparama1 = DAC.Parameter("firstname", objcom_reg.Firstname, DbType.String, ParameterDirection.Input);
      DbParameter dbparama2 = DAC.Parameter("lastname", objcom_reg.Lastname, DbType.String, ParameterDirection.Input);
      DbParameter dbparama3 = DAC.Parameter("username", objcom_reg.Username, DbType.String, ParameterDirection.Input);
      DbParameter dbparama4 = DAC.Parameter("password", objcom_reg.Password, DbType.String, ParameterDirection.Input);
      DbParameter dbparama5 = DAC.Parameter("conformpassword", objcom_reg.Conformpassword, DbType.String, ParameterDirection.Input);
      DbParameter dbparama6 = DAC.Parameter("mobile", objcom_reg.Mobile, DbType.String, ParameterDirection.Input);
      DbParameter dbparama7 = DAC.Parameter("currentloc", objcom_reg.Currentlocation, DbType.String, ParameterDirection.Input);
      DbParameter dbparama8 = DAC.Parameter("prefferedjobloc", objcom_reg.Prefferedjobloc, DbType.String, Parame

      M L J R 4 Replies Last reply
      0
      • M mylogics

        i have a stored procedure named insertreg: DELIMITER $$DROP PROCEDURE IF EXISTS `naukri4u`.`insertreg`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `insertreg`(emailaddress varchar(50),firstname varchar(50),lastname varchar(50),username varchar(50),password varchar(50),conformpassword varchar(50),mobile varchar(50),currentloc varchar(50),prefferedjobloc varchar(50),gender varchar(50),totalexp varchar(50),industry varchar(50),function varchar(50),keyskills varchar(50),highestqual varchar(50),yearofpass varchar(50),institute varchar(50),resumetitle varchar(50),resume varchar(50)) BEGIN insert into registration(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume) values(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume); END$$DELIMITER ; i want to submit a regisration form using this stored proc.this registration table have primary key reg_id which auto increments so i have not taken it in my query.the code i have written is:

        public DataSet insert(Common.com_registration objcom_reg)
        {
        registration reg = new registration();
        try
        {
        DbParameter dbparama0 = DAC.Parameter("emailaddress", objcom_reg.Emailaddress, DbType.String, ParameterDirection.Input);
        DbParameter dbparama1 = DAC.Parameter("firstname", objcom_reg.Firstname, DbType.String, ParameterDirection.Input);
        DbParameter dbparama2 = DAC.Parameter("lastname", objcom_reg.Lastname, DbType.String, ParameterDirection.Input);
        DbParameter dbparama3 = DAC.Parameter("username", objcom_reg.Username, DbType.String, ParameterDirection.Input);
        DbParameter dbparama4 = DAC.Parameter("password", objcom_reg.Password, DbType.String, ParameterDirection.Input);
        DbParameter dbparama5 = DAC.Parameter("conformpassword", objcom_reg.Conformpassword, DbType.String, ParameterDirection.Input);
        DbParameter dbparama6 = DAC.Parameter("mobile", objcom_reg.Mobile, DbType.String, ParameterDirection.Input);
        DbParameter dbparama7 = DAC.Parameter("currentloc", objcom_reg.Currentlocation, DbType.String, ParameterDirection.Input);
        DbParameter dbparama8 = DAC.Parameter("prefferedjobloc", objcom_reg.Prefferedjobloc, DbType.String, Parame

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #5

        Put a break point in the code and check each objcom_reg. value, see if a string value is not initialised and is therefore null.

        Never underestimate the power of human stupidity RAH

        M 1 Reply Last reply
        0
        • M Mycroft Holmes

          Put a break point in the code and check each objcom_reg. value, see if a string value is not initialised and is therefore null.

          Never underestimate the power of human stupidity RAH

          M Offline
          M Offline
          mylogics
          wrote on last edited by
          #6

          i have chechked several time sthe code is correct.evwerythinworks finebut the error comes at line:

          return DAC.SelectDS("insertreg", dbparamcoll);

          afterb this line the control skip to exception block.

          1 Reply Last reply
          0
          • M mylogics

            i have a stored procedure named insertreg: DELIMITER $$DROP PROCEDURE IF EXISTS `naukri4u`.`insertreg`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `insertreg`(emailaddress varchar(50),firstname varchar(50),lastname varchar(50),username varchar(50),password varchar(50),conformpassword varchar(50),mobile varchar(50),currentloc varchar(50),prefferedjobloc varchar(50),gender varchar(50),totalexp varchar(50),industry varchar(50),function varchar(50),keyskills varchar(50),highestqual varchar(50),yearofpass varchar(50),institute varchar(50),resumetitle varchar(50),resume varchar(50)) BEGIN insert into registration(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume) values(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume); END$$DELIMITER ; i want to submit a regisration form using this stored proc.this registration table have primary key reg_id which auto increments so i have not taken it in my query.the code i have written is:

            public DataSet insert(Common.com_registration objcom_reg)
            {
            registration reg = new registration();
            try
            {
            DbParameter dbparama0 = DAC.Parameter("emailaddress", objcom_reg.Emailaddress, DbType.String, ParameterDirection.Input);
            DbParameter dbparama1 = DAC.Parameter("firstname", objcom_reg.Firstname, DbType.String, ParameterDirection.Input);
            DbParameter dbparama2 = DAC.Parameter("lastname", objcom_reg.Lastname, DbType.String, ParameterDirection.Input);
            DbParameter dbparama3 = DAC.Parameter("username", objcom_reg.Username, DbType.String, ParameterDirection.Input);
            DbParameter dbparama4 = DAC.Parameter("password", objcom_reg.Password, DbType.String, ParameterDirection.Input);
            DbParameter dbparama5 = DAC.Parameter("conformpassword", objcom_reg.Conformpassword, DbType.String, ParameterDirection.Input);
            DbParameter dbparama6 = DAC.Parameter("mobile", objcom_reg.Mobile, DbType.String, ParameterDirection.Input);
            DbParameter dbparama7 = DAC.Parameter("currentloc", objcom_reg.Currentlocation, DbType.String, ParameterDirection.Input);
            DbParameter dbparama8 = DAC.Parameter("prefferedjobloc", objcom_reg.Prefferedjobloc, DbType.String, Parame

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #7

            and what are dbparama2,dbparama3,dbparama4,dbparama5,dbparama6,dbparama7,dbparama8,dbparama9,dbparama10,dbparama11,dbparama12,dbparama13,dbparama14,dbparama15,dbparama16,dbparama17,dbparama18? :confused:

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            M 1 Reply Last reply
            0
            • L Luc Pattyn

              and what are dbparama2,dbparama3,dbparama4,dbparama5,dbparama6,dbparama7,dbparama8,dbparama9,dbparama10,dbparama11,dbparama12,dbparama13,dbparama14,dbparama15,dbparama16,dbparama17,dbparama18? :confused:

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #8

              Hasn't really worked out the array thingy yet!

              Never underestimate the power of human stupidity RAH

              1 Reply Last reply
              0
              • M mylogics

                i have a stored procedure named insertreg: DELIMITER $$DROP PROCEDURE IF EXISTS `naukri4u`.`insertreg`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `insertreg`(emailaddress varchar(50),firstname varchar(50),lastname varchar(50),username varchar(50),password varchar(50),conformpassword varchar(50),mobile varchar(50),currentloc varchar(50),prefferedjobloc varchar(50),gender varchar(50),totalexp varchar(50),industry varchar(50),function varchar(50),keyskills varchar(50),highestqual varchar(50),yearofpass varchar(50),institute varchar(50),resumetitle varchar(50),resume varchar(50)) BEGIN insert into registration(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume) values(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume); END$$DELIMITER ; i want to submit a regisration form using this stored proc.this registration table have primary key reg_id which auto increments so i have not taken it in my query.the code i have written is:

                public DataSet insert(Common.com_registration objcom_reg)
                {
                registration reg = new registration();
                try
                {
                DbParameter dbparama0 = DAC.Parameter("emailaddress", objcom_reg.Emailaddress, DbType.String, ParameterDirection.Input);
                DbParameter dbparama1 = DAC.Parameter("firstname", objcom_reg.Firstname, DbType.String, ParameterDirection.Input);
                DbParameter dbparama2 = DAC.Parameter("lastname", objcom_reg.Lastname, DbType.String, ParameterDirection.Input);
                DbParameter dbparama3 = DAC.Parameter("username", objcom_reg.Username, DbType.String, ParameterDirection.Input);
                DbParameter dbparama4 = DAC.Parameter("password", objcom_reg.Password, DbType.String, ParameterDirection.Input);
                DbParameter dbparama5 = DAC.Parameter("conformpassword", objcom_reg.Conformpassword, DbType.String, ParameterDirection.Input);
                DbParameter dbparama6 = DAC.Parameter("mobile", objcom_reg.Mobile, DbType.String, ParameterDirection.Input);
                DbParameter dbparama7 = DAC.Parameter("currentloc", objcom_reg.Currentlocation, DbType.String, ParameterDirection.Input);
                DbParameter dbparama8 = DAC.Parameter("prefferedjobloc", objcom_reg.Prefferedjobloc, DbType.String, Parame

                J Offline
                J Offline
                Jorgen Andersson
                wrote on last edited by
                #9

                <edit>You are setting dbparamcoll twice but with different parameters. The first setting is never used.</edit> Ok, it's official, I'm blind like a bat.

                "When did ignorance become a point of view" - Dilbert

                modified on Monday, November 29, 2010 11:18 AM

                L 1 Reply Last reply
                0
                • J Jorgen Andersson

                  <edit>You are setting dbparamcoll twice but with different parameters. The first setting is never used.</edit> Ok, it's official, I'm blind like a bat.

                  "When did ignorance become a point of view" - Dilbert

                  modified on Monday, November 29, 2010 11:18 AM

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #10

                  actually there are two arrays with different casing, and it is the second one that isn't used. :)

                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                  Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                  J 1 Reply Last reply
                  0
                  • L Luc Pattyn

                    actually there are two arrays with different casing, and it is the second one that isn't used. :)

                    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                    Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                    J Offline
                    J Offline
                    Jorgen Andersson
                    wrote on last edited by
                    #11

                    Crap, That's a sign that I need to go home now.

                    "When did ignorance become a point of view" - Dilbert

                    1 Reply Last reply
                    0
                    • M mylogics

                      i have a stored procedure named insertreg: DELIMITER $$DROP PROCEDURE IF EXISTS `naukri4u`.`insertreg`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `insertreg`(emailaddress varchar(50),firstname varchar(50),lastname varchar(50),username varchar(50),password varchar(50),conformpassword varchar(50),mobile varchar(50),currentloc varchar(50),prefferedjobloc varchar(50),gender varchar(50),totalexp varchar(50),industry varchar(50),function varchar(50),keyskills varchar(50),highestqual varchar(50),yearofpass varchar(50),institute varchar(50),resumetitle varchar(50),resume varchar(50)) BEGIN insert into registration(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume) values(emailaddress,firstname,lastname,username,password,conformpassword,mobile,currentloc,prefferedjobloc,gender,totalexp,industry,function,keyskills,highestqual,yearofpass,institute,resumetitle,resume); END$$DELIMITER ; i want to submit a regisration form using this stored proc.this registration table have primary key reg_id which auto increments so i have not taken it in my query.the code i have written is:

                      public DataSet insert(Common.com_registration objcom_reg)
                      {
                      registration reg = new registration();
                      try
                      {
                      DbParameter dbparama0 = DAC.Parameter("emailaddress", objcom_reg.Emailaddress, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama1 = DAC.Parameter("firstname", objcom_reg.Firstname, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama2 = DAC.Parameter("lastname", objcom_reg.Lastname, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama3 = DAC.Parameter("username", objcom_reg.Username, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama4 = DAC.Parameter("password", objcom_reg.Password, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama5 = DAC.Parameter("conformpassword", objcom_reg.Conformpassword, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama6 = DAC.Parameter("mobile", objcom_reg.Mobile, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama7 = DAC.Parameter("currentloc", objcom_reg.Currentlocation, DbType.String, ParameterDirection.Input);
                      DbParameter dbparama8 = DAC.Parameter("prefferedjobloc", objcom_reg.Prefferedjobloc, DbType.String, Parame

                      R Offline
                      R Offline
                      RyanEK
                      wrote on last edited by
                      #12

                      I suspect your insertreg procedure is not providing a value for a key column.

                      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