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 Subyou'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
Monday, March 26, 2012
This is rediculous: Still not able to Add a row!??
Labels:
adda,
asp,
bare,
essentials,
net,
pulling,
rediculous,
reduced,
row
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment