help !

Discussion in 'ASP .Net Web Controls' started by dotnethelp, Apr 19, 2004.

  1. dotnethelp

    dotnethelp Guest

    Suppose I have 2 textboxes txtRollno and txtName to input data from user

    .. When I press a button (btnInsert) to insert a row from user then it

    inserts a new row and puts data of textboxes in that row .

    There is another button (btnSave) to save the record permanently in actual

    table. My code is



    Event is :

    BtnInsert_Click

    Code is :

    DataRow dr=DataSet1.Tables(0).newrow

    dr(0)=txtRollno.Text

    dr(1)=txtName.Text

    DataSet1.Tables(0).Rows.Add(dr)

    [ When I test it then new row is reflected to DataSet1]





    Event is :

    BtnSave_Click

    Code is :

    Dim cmp as new sqlCommandBuilder(sqlDataAdapter1)

    SqlDataAdapter1.Update(DataSet1.Tables(0))

    [ At this stage it is not updating new rows in actual table. Even it is

    displaying old

    data in dataset not updated data which was displaying in previous button

    click. How can I solve this problem.]
    dotnethelp, Apr 19, 2004
    #1
    1. Advertising

  2. dotnethelp

    Dhaval Naik Guest

    You need to call your BtnInsert_Click event before you actually save your
    data in your BtnSave_Click event. Something like this.

    BtnSave_Click

    Code is :

    Call BtnInsert_Click()

    Dim cmp as new sqlCommandBuilder(sqlDataAdapter1)

    SqlDataAdapter1.Update(DataSet1.Tables(0))


    "dotnethelp" <> wrote in message
    news:...
    > Suppose I have 2 textboxes txtRollno and txtName to input data from user
    >
    > . When I press a button (btnInsert) to insert a row from user then it
    >
    > inserts a new row and puts data of textboxes in that row .
    >
    > There is another button (btnSave) to save the record permanently in actual
    >
    > table. My code is
    >
    >
    >
    > Event is :
    >
    > BtnInsert_Click
    >
    > Code is :
    >
    > DataRow dr=DataSet1.Tables(0).newrow
    >
    > dr(0)=txtRollno.Text
    >
    > dr(1)=txtName.Text
    >
    > DataSet1.Tables(0).Rows.Add(dr)
    >
    > [ When I test it then new row is reflected to DataSet1]
    >
    >
    >
    >
    >
    > Event is :
    >
    > BtnSave_Click
    >
    > Code is :
    >
    > Dim cmp as new sqlCommandBuilder(sqlDataAdapter1)
    >
    > SqlDataAdapter1.Update(DataSet1.Tables(0))
    >
    > [ At this stage it is not updating new rows in actual table. Even it is
    >
    > displaying old
    >
    > data in dataset not updated data which was displaying in previous button
    >
    > click. How can I solve this problem.]
    >
    >
    Dhaval Naik, Apr 19, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dHJlbGxvdzQyMg==?=

    HELP! HELP! HELP! Opening Web Application Project Error

    =?Utf-8?B?dHJlbGxvdzQyMg==?=, Feb 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    741
    =?Utf-8?B?dHJlbGxvdzQyMg==?=
    Feb 20, 2004
  2. Harvey
    Replies:
    0
    Views:
    665
    Harvey
    Jul 16, 2004
  3. Harvey
    Replies:
    1
    Views:
    817
    Daniel
    Jul 16, 2004
  4. =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=

    HELP - HELP - HELP

    =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=, Mar 9, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    660
    Eliyahu Goldin
    Mar 9, 2006
  5. Buster

    Help, Help, Help

    Buster, Oct 4, 2003, in forum: Java
    Replies:
    3
    Views:
    460
    Saager
    Oct 30, 2003
Loading...

Share This Page