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
Ankur gupta
NA
8
2.8k
error in inserting values in access
Jul 6 2010 11:40 AM
i am facing this error............
"
Update requires a valid InsertCommand when passed DataRow collection with new rows
"
when i am running this code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Dim cb11 As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(da_purchase_master)
If rdpur.Checked = True Then
da_purchase_master = New OleDb.OleDbDataAdapter("select * from purchase_master ", con)
ds_purchase_master = New DataSet
da_purchase_master.Fill(ds_purchase_master, "dpm")
Dim dspurrow As DataRow
dspurrow = ds_purchase_master.Tables("dpm").NewRow
dspurrow.Item("purchase_id") = 345
dspurrow.Item("purchase_date") = dtpdate.Value
dspurrow.Item("purchase_mode") = "cash"
dspurrow.Item("purchase_cost") = 444
Dim str = cmbname.Text
dspurrow.Item("vendor_id") = Val(str.Split("-")(0))
dspurrow.Item("from") = "vendor"
dspurrow.Item("advance") = 5677
dspurrow.Item("balance_amnt") = 785
ds_purchase_master.Tables("dpm").Rows.Add(dspurrow)
da_purchase_master.Update(ds_purchase_master, "dpm")
MsgBox("detail saved", MsgBoxStyle.Information, "PURCHASE DETAILS")
End If
endsub
connection with acess is established in module :
Public Sub connection_start()
Dim cstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=temp.accdb"
con = New OleDb.OleDbConnection
con.ConnectionString = cstring
con.Open()
End Sub
please help me with this error
Reply
Answers (
3
)
Regarding Login Control
Picture mail