L
Lloyd Sheen
I am having trouble with an app that does the following:
1. Query SQL Server and return one row
2. Bind the columns to text boxes
3. User updates info
4. User clicks update button
Questions:
1. Is data binding one direction.
2. If the user changes a value in a text box how does that value get back
to the dataset or does it?
Code is as follows:
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 Page.IsPostBack Then
Me.SqlConnection1.Open()
Me.SqlDataAdapter1.Fill(Me.TerrDataSet)
Dim dv As DataView = Me.TerrDataSet.Tables(0).DefaultView
Me.DataBind()
Me.SqlConnection1.Close()
Me.Session.Add("DataSet", Me.TerrDataSet)
Else
Me.TerrDataSet = CType(Me.Session.Item("DataSet"), TerrDataSet)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim picnt As Integer
Me.SqlConnection1.Open()
Try
picnt = Me.SqlDataAdapter1.Update(Me.TerrDataSet)
Catch ex As Exception
Dim s As String = ex.Message
End Try
Me.SqlConnection1.Close()
End Sub
Lloyd Sheen
1. Query SQL Server and return one row
2. Bind the columns to text boxes
3. User updates info
4. User clicks update button
Questions:
1. Is data binding one direction.
2. If the user changes a value in a text box how does that value get back
to the dataset or does it?
Code is as follows:
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 Page.IsPostBack Then
Me.SqlConnection1.Open()
Me.SqlDataAdapter1.Fill(Me.TerrDataSet)
Dim dv As DataView = Me.TerrDataSet.Tables(0).DefaultView
Me.DataBind()
Me.SqlConnection1.Close()
Me.Session.Add("DataSet", Me.TerrDataSet)
Else
Me.TerrDataSet = CType(Me.Session.Item("DataSet"), TerrDataSet)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim picnt As Integer
Me.SqlConnection1.Open()
Try
picnt = Me.SqlDataAdapter1.Update(Me.TerrDataSet)
Catch ex As Exception
Dim s As String = ex.Message
End Try
Me.SqlConnection1.Close()
End Sub
Lloyd Sheen