Computing.Net > Forums > Database > VB.net 2008 database manipulation help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB.net 2008 database manipulation help

Reply to Message Icon

Name: ror
Date: July 6, 2009 at 08:51:03 Pacific
OS: Windows XP
Subcategory: General
Comment:

plz help me figure out whts wrong with this code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Administrator\My Documents\db1.mdb"
con.Open()
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim Sql As String = "SELECT * FROM SaleTable"
da = New OleDb.OleDbDataAdapter(Sql, con)
Dim cb As New OleDb.OleDbCommandBuilder(da)

Dim dsNewRow As DataRow = ds.Tables("SaleTable").NewRow()
dsNewRow.Item("Date") = Label2.Text

If CheckBox1.Checked Then
dsNewRow.Item("ClientId") = TextBox1.Text

End If

If CheckBox2.Checked Then
dsNewRow.Item("InvoiceType") = "SSinvoice"
End If
If CheckBox4.Checked Then
dsNewRow.Item("PaymentMethod") = "Check"
End If
If CheckBox5.Checked Then
dsNewRow.Item("PaymentMethod") = "CreditCard"
End If
If CheckBox6.Checked Then
dsNewRow.Item("PaymentMethod") = "Debt"
End If

ds.Tables("SaleTable").Rows.Add(dsNewRow)

da.Update(ds, "SaleTable")

con.Close()
End Sub



Sponsored Link
Ads by Google

Response Number 1
Name: eley
Date: October 22, 2009 at 02:29:53 Pacific
Reply:

what's the error message?


0
Reply to Message Icon

Related Posts

See More


cross table delete Setting up SQL on my home...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: VB.net 2008 database manipulation help

VB.net with sql server 2008 www.computing.net/answers/dbase/vbnet-with-sql-server-2008/579.html

Sync online database to offline dat www.computing.net/answers/dbase/sync-online-database-to-offline-dat/155.html

Project Suggestions www.computing.net/answers/dbase/project-suggestions/374.html