Advertisement
Advertisement
| 06.03.2008 at 09:17AM PDT, ID: 23453714 |
|
[x]
Attachment Details
|
||
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: |
Public Class Form1
Dim ds As DataSet
Dim daBookings, daASNs As SqlDataAdapter
Dim cb As SqlCommandBuilder
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ds = New DataSet()
Dim con As New SqlConnection()
con.ConnectionString = "Data Source=CLIENT165\SQLEXPRESS;DataBase=c:\Visual Studio 2005\Projects\GreenVesselTally\GreenVesselTally\GreenVesselTally.mdf;uid=norge;pwd=boris;Trusted_Connection=True"
daBookings = New SqlDataAdapter("SELECT * FROM Bookings", con)
daASNs = New SqlDataAdapter("SELECT * FROM ASNs", con)
daBookings.Fill(ds, "Bookings")
daASNs.Fill(ds, "ASNs")
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim Rows As Integer
cb = New SqlCommandBuilder(daBookings)
cb.GetUpdateCommand()
cb.GetDeleteCommand()
Rows = daBookings.Update(ds.Tables("Bookings"))
cb = New SqlCommandBuilder(daASNs)
cb.GetUpdateCommand()
Rows = daASNs.Update(ds.Tables("ASNs"))
|