This is rediculous: Still not able to Add a row!!!???

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default This is rediculous: Still not able to Add a row!!!???

    I have reduced this thing down to the bare essentials and I still cannot add
    a row. I have taken the suggestions and nothing.
    I am pulling from the DB just find I just cannot add (so my connection is
    good). I step thhrough this thing and I am definatly seeing a new row
    getting added to the dataset so something must be wrong with the way I am
    updateing the dataadapter...HELP!!! (THESE ARE ALL VISUAL CONTROLS)

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    If Not IsPostBack Then
    'Brand NEW request Fill the dataset and bind the data to the
    grid
    vdaPasswords.Fill(dsPasswords1)
    Session("dsPasswords") = dsPasswords1
    BindGrid()
    End If
    End Sub


    ' Bind the database to the table
    Private Sub BindGrid()
    dsPasswords1 = Session("dsPasswords")
    DataGrid1.DataSource = dsPasswords1
    DataGrid1.DataBind()
    End Sub

    ' The "Add" button on this form is separate from the grid
    Private Sub Add()
    Dim dr As dsPasswords.PasswordsRow
    dsPasswords1 = Session("dsPasswords")
    dr = dsPasswords1.Tables("Passwords").NewRow()
    dr("NUMBER") = 180
    dr("USERNAME") = "SDASD"
    dsPasswords1.Tables("Passwords").Rows.InsertAt(dr, 0)
    DataGrid1.EditItemIndex = 0


    dsPasswords1.AcceptChanges()
    vdaPasswords.Update(dsPasswords1)


    End Sub


    Aaron Ackerman Guest

  2. #2

    Default Re: This is rediculous: Still not able to Add a row!!!???

    you're not binding the new data to the datagrid after you've changed your
    table...

    try...

    Private Sub Add()
    Dim dr As dsPasswords.PasswordsRow
    dsPasswords1 = Session("dsPasswords")
    dr = dsPasswords1.Tables("Passwords").NewRow()
    dr("NUMBER") = 180
    dr("USERNAME") = "SDASD"
    dsPasswords1.Tables("Passwords").Rows.InsertAt(dr, 0)
    DataGrid1.EditItemIndex = 0

    dsPasswords1.AcceptChanges()
    vdaPasswords.Update(dsPasswords1)

    DataGrid1.DataSource = dsPasswords1
    DataGrid1.DataBind()
    Session( "dsPasswords" ) = dsPasswords1

    End Sub



    "Aaron Ackerman" <no@spam.com> wrote in message
    news:%23wfjdbRVDHA.1480@tk2msftngp13.phx.gbl...
    > I have reduced this thing down to the bare essentials and I still cannot
    add
    > a row. I have taken the suggestions and nothing.
    > I am pulling from the DB just find I just cannot add (so my connection is
    > good). I step thhrough this thing and I am definatly seeing a new row
    > getting added to the dataset so something must be wrong with the way I am
    > updateing the dataadapter...HELP!!! (THESE ARE ALL VISUAL CONTROLS)
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    > If Not IsPostBack Then
    > 'Brand NEW request Fill the dataset and bind the data to the
    > grid
    > vdaPasswords.Fill(dsPasswords1)
    > Session("dsPasswords") = dsPasswords1
    > BindGrid()
    > End If
    > End Sub
    >
    >
    > ' Bind the database to the table
    > Private Sub BindGrid()
    > dsPasswords1 = Session("dsPasswords")
    > DataGrid1.DataSource = dsPasswords1
    > DataGrid1.DataBind()
    > End Sub
    >
    > ' The "Add" button on this form is separate from the grid
    > Private Sub Add()
    > Dim dr As dsPasswords.PasswordsRow
    > dsPasswords1 = Session("dsPasswords")
    > dr = dsPasswords1.Tables("Passwords").NewRow()
    > dr("NUMBER") = 180
    > dr("USERNAME") = "SDASD"
    > dsPasswords1.Tables("Passwords").Rows.InsertAt(dr, 0)
    > DataGrid1.EditItemIndex = 0
    >
    >
    > dsPasswords1.AcceptChanges()
    > vdaPasswords.Update(dsPasswords1)
    >
    >
    > End Sub
    >
    >

    Daniel Bass Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139