TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Robert Reese
NA
3
0
Implimenting update method on VB.Net Application
Jan 8 2009 3:18 AM
I am trying to get the update method to update data in datebase using a datagrid in VB.Net application. The code I have placed compiles but the data does not update. If anyone can please point me in the right direction in what it is I am doing wrong. Please help! I have posted the code below.
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'BowlingDataSet.Bowl' table. You can move, or remove it, as needed.
Me.BowlTableAdapter.Fill(Me.BowlingDataSet.Bowl)
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\bowling.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection
myConnection.ConnectionString = connString
' create a data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from Bowl", myConnection)
' create a new dataset
Dim ds As DataSet = New DataSet
da.Fill(ds, "Bowl")
DataGridView1.DataSource = ds.DefaultViewManager
Me.BowlTableAdapter.Fill(Me.BowlingDataSet.Bowl)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Public Function CreateCommandAndUpdate( _
ByVal connectionString As String, _
ByVal queryString As String) As DataSet
Dim dataSet As DataSet = New DataSet
Using connection As New OleDbConnection(connectionString)
connection.Open()
Dim adapter As New OleDbDataAdapter()
adapter.SelectCommand = New OleDbCommand( _
queryString, connection)
Dim builder As OleDbCommandBuilder = _
New OleDbCommandBuilder(adapter)
adapter.Fill(dataSet)
builder.GetUpdateCommand()
adapter.Update(dataSet)
End Using
Return dataSet
End Function
End Class
Reply
Answers (
1
)
Screen Scrapping in c#
problem with storeprocedure creation