Saving to a database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mercea
    New Member
    • Aug 2007
    • 35

    #16
    Originally posted by Plater
    To be honest I'm shooting in the dark here, I normally do everything in code and not as embeded objects in UI so I'm not familiar with their command structure.

    It just seemed like you were naming possibly multiple things with the same ID and then your insert parameter couldn't find it for some reason.
    So if you named everything something unique, you could see which one was causing the problem.
    I'm beginning to suspect that i've missed some fundamental concept here. so i want to review the basics with u if u dont mind:

    -the data can be generated on page1.aspx and saved on page2.aspx right?

    -the insert() method can be placed in the page1.aspx code and it'll save on page2 provided the gridview is configured for the datasource right?

    -can i configure 2 gridviews on seperate pages with 1 datasource? i want one to be read-only and the other editable. is it possible?

    -the datasource mode property is set to dataset. so am i to create a new object of the dataset or configuring the datasource and gridview takes care of all that?

    Code:
     addstudentinfo.InsertParameters["Surname"].DefaultValue =
                        TextBox1.Text.ToString();
                    addstudentinfo.InsertParameters["Names"].DefaultValue =
                        TextBox2.Text.ToString();
                    addstudentinfo.InsertParameters["Regno"].DefaultValue =
                        TextBox3.Text.ToString();
    -Is the above code not declaring the variables?
    thanks...

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #17
      Originally posted by mercea
      -the data can be generated on page1.aspx and saved on page2.aspx right?
      Actually, I suspect no? I don't think you can use the same object like on both pages?

      Comment

      • mercea
        New Member
        • Aug 2007
        • 35

        #18
        Originally posted by Plater
        Actually, I suspect no? I don't think you can use the same object like on both pages?
        hi all,
        thanks a lot for your input. i finally saw the problem. i took out the insert command and the Executenonquery () in the code-behind page and it worked!!

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #19
          Originally posted by mercea
          hi all,
          thanks a lot for your input. i finally saw the problem. i took out the insert command and the Executenonquery () in the code-behind page and it worked!!
          Awesome :)

          Thanks for sharing the solution!

          Comment

          Working...