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#
  4. Form issue.

Form issue.

Scheduled Pinned Locked Moved C#
databasehelp
6 Posts 4 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.
  • S Offline
    S Offline
    spankyleo123
    wrote on last edited by
    #1

    Hi folks, I am entering data into the db from a winform. The save button handles the insertion of the form data into the db. The form has all fields for insertion into the table. Some field of the table are set to database defaults like getdate() and suser_sname. When I hit the save button .... the default values are not getting interted into the db they are NULL when i query the db. please provide you suggestions to relove this issue . thanks

    OriginalGriffO S S 3 Replies Last reply
    0
    • S spankyleo123

      Hi folks, I am entering data into the db from a winform. The save button handles the insertion of the form data into the db. The form has all fields for insertion into the table. Some field of the table are set to database defaults like getdate() and suser_sname. When I hit the save button .... the default values are not getting interted into the db they are NULL when i query the db. please provide you suggestions to relove this issue . thanks

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      I think we will need to see the code for the save button - please use the "code block" widget when you post it.

      All those who believe in psycho kinesis, raise my hand. My :badger:'s gonna unleash hell on your ass. :badger:tastic!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      S 1 Reply Last reply
      0
      • S spankyleo123

        Hi folks, I am entering data into the db from a winform. The save button handles the insertion of the form data into the db. The form has all fields for insertion into the table. Some field of the table are set to database defaults like getdate() and suser_sname. When I hit the save button .... the default values are not getting interted into the db they are NULL when i query the db. please provide you suggestions to relove this issue . thanks

        S Offline
        S Offline
        Syed Shahid Hussain
        wrote on last edited by
        #3

        Check ur query otherwise it is not possible to face this type of problem. ;) (And past code also, For more exact answer)

        Syed Shahid Hussain

        S 1 Reply Last reply
        0
        • S spankyleo123

          Hi folks, I am entering data into the db from a winform. The save button handles the insertion of the form data into the db. The form has all fields for insertion into the table. Some field of the table are set to database defaults like getdate() and suser_sname. When I hit the save button .... the default values are not getting interted into the db they are NULL when i query the db. please provide you suggestions to relove this issue . thanks

          S Offline
          S Offline
          sanforjackass
          wrote on last edited by
          #4

          i dont know if there is a way but when i face like this problem i did for loop to check if there is a null value and replace it with 0. i hope that will help

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            I think we will need to see the code for the save button - please use the "code block" widget when you post it.

            All those who believe in psycho kinesis, raise my hand. My :badger:'s gonna unleash hell on your ass. :badger:tastic!

            S Offline
            S Offline
            spankyleo123
            wrote on last edited by
            #5

            //SAVE Button Click event

                   {
                     tbSystem tb = new tbSystem();
                     tb.System\_DeliveryDate = System\_DeliveryDateDateTimePicker.Value;
                     tb.System\_Description = System\_DescriptionRichTextBox.Text;
                     tb.System\_Name = System\_NameTextBox.Text;
                     tb.System\_Priority = (int)System\_PriorityComboBox.SelectedValue;
                     tb.System\_Status = (int)System\_StatusComboBox.SelectedValue;
            
                     //LastEditBy and CreatedBy Fields are set to database default suser\_sname()
                     //LastEditDate and CreationDate are set to database default getdate() 
            
                        try
                        {
                            tmx.tbSystem.InsertOnSubmit(tb);   // tmx is the datacontext tmx = new datacontext()
                            tmx.SubmitChanges();
                            
                        }
                        catch (Exception ex)
                        {
                            throw new Exception(ex.Message);
                        }
            
                        MessageBox.Show("Date is Validated and saved");
                    }
            
            1 Reply Last reply
            0
            • S Syed Shahid Hussain

              Check ur query otherwise it is not possible to face this type of problem. ;) (And past code also, For more exact answer)

              Syed Shahid Hussain

              S Offline
              S Offline
              spankyleo123
              wrote on last edited by
              #6

              Just pasted code in the reply above

              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