A
Aaron Ackerman
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried
everything and I am at a loss. The using goes into add mode with the add
button adds his data then updates with the update button, seems simple.
I am using ALL visual controls (supposedly to simplify things. If I was not
using the visual controls and calling an ExecuteNonQuery no prob.
Please look at my code and tell me what I am doing wrong. Also, what are the
advatages and disadvantages of using the visual controls and typed Datasets.
THANKS SO MUCH!!!!
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 IsPostBack Then
If Not (Request.Form("btnAdd") Is Nothing) Then
Add()
End If
Else
BindGrid()
End If
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
Update()
End Sub
' Bind the database to the table
Private Sub BindGrid()
vdaPasswords.Fill(dsPasswords1)
If Session("dsPasswords") Is Nothing Then
Session("dsPasswords") = dsPasswords1
End If
DataGrid1.DataSource = dsPasswords1
DataGrid1.DataBind()
End Sub
' The "Add" sub
Private Sub Add()
Dim dr As dsPasswords.PasswordsRow
If dsPasswords1 Is Nothing Then
dsPasswords1 = Session("dsPasswords")
End If
dr = dsPasswords1.Tables("Passwords").NewRow()
dr("NUMBER") = 80
dr("USERNAME") = "SDASD"
dsPasswords1.Tables("Passwords").Rows.InsertAt(dr, 0)
DataGrid1.EditItemIndex = 0
BindGrid()
End Sub
' User clicked "update".
Sub Update()
' Either insert a new row or update the existing row here,
' depending on whether adding or not.
DataGrid1.EditItemIndex = -1
BindGrid()
End Sub
everything and I am at a loss. The using goes into add mode with the add
button adds his data then updates with the update button, seems simple.
I am using ALL visual controls (supposedly to simplify things. If I was not
using the visual controls and calling an ExecuteNonQuery no prob.
Please look at my code and tell me what I am doing wrong. Also, what are the
advatages and disadvantages of using the visual controls and typed Datasets.
THANKS SO MUCH!!!!
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 IsPostBack Then
If Not (Request.Form("btnAdd") Is Nothing) Then
Add()
End If
Else
BindGrid()
End If
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
Update()
End Sub
' Bind the database to the table
Private Sub BindGrid()
vdaPasswords.Fill(dsPasswords1)
If Session("dsPasswords") Is Nothing Then
Session("dsPasswords") = dsPasswords1
End If
DataGrid1.DataSource = dsPasswords1
DataGrid1.DataBind()
End Sub
' The "Add" sub
Private Sub Add()
Dim dr As dsPasswords.PasswordsRow
If dsPasswords1 Is Nothing Then
dsPasswords1 = Session("dsPasswords")
End If
dr = dsPasswords1.Tables("Passwords").NewRow()
dr("NUMBER") = 80
dr("USERNAME") = "SDASD"
dsPasswords1.Tables("Passwords").Rows.InsertAt(dr, 0)
DataGrid1.EditItemIndex = 0
BindGrid()
End Sub
' User clicked "update".
Sub Update()
' Either insert a new row or update the existing row here,
' depending on whether adding or not.
DataGrid1.EditItemIndex = -1
BindGrid()
End Sub