Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Private conn As SqlConnection
- Private DA As SqlDataAdapter
- Private DS As System.Data.DataSet
- Private CB As SqlCommandBuilder
- Private ROW As DataRow
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- If Not IsPostBack Then
- Call GETNWDS()
- ' updateprogrammaly
- ContactNamebox.Text = Now
- 'Call UpdateNWDS()
- End If
- End Sub
- Public Sub GETNWDS()
- '' opencustumorDataAdapterdaaset DS
- Dim connectionString = ConfigurationManager.ConnectionStrings("NW testConnectionString").ConnectionString
- Dim queryString As String = "SELECT CustomerID, CompanyName, ContactName FROM Customers where CustomerID='ALFKI'"
- Dim conn As New SqlConnection(connectionString)
- DA = New SqlDataAdapter(queryString, conn)
- DS = New System.Data.DataSet
- DA.Fill(DS)
- Dim DT As DataTable = DS.Tables(0)
- ROW = DT(0)
- CustomerIDbox.Text = ROW("CustomerID").ToString
- CompanyNamebox.Text = ROW("CompanyName").ToString
- ContactNamebox.Text = ROW("ContactName").ToString
- End Sub
- Public Sub UpdateNWDS()
- 'TODO Complete update code
- 'update-HOW TO SAVE CHANES IN ds AND UODATE DB???????---------
- ' ROW("ContactName") = ContactNamebox.Text 'LKE THIS??????
- CB = New SqlCommandBuilder(DA)
- Try
- 'Update the database using the data adapter
- DA.Update(DS)
- Catch x As Exception
- ' Error during Update, add code to locate error, reconcile
- ' and try to update again.
- End Try
- End Sub
- Protected Sub SaveButton_Click(sender As Object, e As EventArgs) Handles Me.Load
- Call UpdateNWDS()
- End Sub
Add Comment
Please, Sign In to add comment