edit records through dataset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bharathi228
    New Member
    • Jul 2008
    • 28

    edit records through dataset

    How to add new records through dataset and how to edit,update that records through dataset.and also how can i update that new records to database.iam using asp,net with vb.net
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    bharathi228,

    Please don't ask questions here that can be easily researched in books or online. Check out these links and if you have any specific problems with your code then our experts will be happy to help.

    Dr B
    MODERATOR

    Comment

    • bharathi228
      New Member
      • Jul 2008
      • 28

      #3
      Originally posted by DrBunchman
      bharathi228,

      Please don't ask questions here that can be easily researched in books or online. Check out these links and if you have any specific problems with your code then our experts will be happy to help.

      Dr B
      MODERATOR

      thanks for u r reply.but that links are not useful for me.already iam searching in online and google.thats why i put question here.

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Okay, so why aren't any of those useful to you? There's a few different examples there showing you how updating a dataset can be done.

        Have you tried anything so far? If so print your code here and I'll take a look.

        Dr B

        Comment

        • bharathi228
          New Member
          • Jul 2008
          • 28

          #5
          Originally posted by DrBunchman
          Okay, so why aren't any of those useful to you? There's a few different examples there showing you how updating a dataset can be done.

          Have you tried anything so far? If so print your code here and I'll take a look.

          Dr B
          this code for adding records through dataset
          Code:
           
          Dim da As New SqlDataAdapter("select * from calc_limit_config", con)
          con.Open()
          da.Fill(ds, "calc_limit_config")
          con.Close()
           
          Dim drnew As Data.DataRow
          drnew = ds.Tables("calc_limit_config").NewRow
          With drnew
          .Item("param") = TextBox1.Text
          .Item("alarm") = TextBox2.Text
          .Item("limit") = TextBox3.Text
           
          End With
          ds.Tables(0).Rows.Add(drnew)
          its working fine.then i can update this new records with database
          Code:
           Dim cb As New SqlCommandBuilder(da) 
          da.UpdateCommand = cb.GetUpdateCommand()
           
          da.Update(ds, "calc_limit_config")
          then i want edit(or)update that particular new records
          Code:
           
          drnew = ds.Tables("calc_limit_config").Select("param = '1')
            
          drnew(0)("alarm") =textbox2.text
          drnew(0)("limit") =textbox3.text
          here the error is

          value of type 1-dimentional array of system.data.dat arow cannot be converted to system.data.dat arow
          Last edited by DrBunchman; Jul 29 '08, 08:11 AM. Reason: Added [Code] Tags - Please use the '#' button

          Comment

          • Curtis Rutland
            Recognized Expert Specialist
            • Apr 2008
            • 3264

            #6
            We have two articles in our howtwos section called Howto Use a Database in your .NET Program. Please read them.

            Comment

            Working...