how to insert/add record in ms access using vb.net
5 posters
Page 1 of 1
how to insert/add record in ms access using vb.net
Try
Dim SqlQuery As String = "INSERT INTO FullNameTable (FirstName,MiddleName,LastName) VALUES ('" & txtFName.Text & "', '" & txtMName.Text & "','" & txtLName.Text & "')"
Dim SqlCommand As New OleDbCommand
With SqlCommand
.CommandText = SqlQuery
.Connection = conn
.ExecuteNonQuery()
End With
MsgBox("One record Successfully Added..")
loadListView()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Dim SqlQuery As String = "INSERT INTO FullNameTable (FirstName,MiddleName,LastName) VALUES ('" & txtFName.Text & "', '" & txtMName.Text & "','" & txtLName.Text & "')"
Dim SqlCommand As New OleDbCommand
With SqlCommand
.CommandText = SqlQuery
.Connection = conn
.ExecuteNonQuery()
End With
MsgBox("One record Successfully Added..")
loadListView()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
putayputay- Newbie
- Posts : 10
Join date : 2013-03-09
sir ask ko lang po about sa nangyari sa ginawa ko if ano po yung mali
sir baka po pwede paki tingen itong gawa ko ginaya ko naman po yung nasa video...pero may error pa din
weirdo- Newbie
- Posts : 2
Join date : 2013-10-10
Re: how to insert/add record in ms access using vb.net
Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click
For i = 0 To DataGridView1.Rows.Count - 1
Dim row1 As String = DataGridView1.Rows(i).Cells(1).Value.ToString
Dim sqlquery As String = "INSERT INTO tblName (FullName) VALUES ('" & row1 & "')"
Dim sqlcommand As New OleDbCommand
With sqlcommand
.CommandText = sqlquery
.Connection = conn
.ExecuteNonQuery()
End With
Next
MsgBox("Record successfully added!")
DataGridView1.Rows.Clear()
btnLoad.PerformClick()
End Sub
pano po ba kung 2 columns na yong iiinsert mo sa database?? example "FullName" and "Address" columns sa database.. tnx
ii88oio88ii- Newbie
- Posts : 5
Join date : 2014-02-08
ii88oio88ii- Newbie
- Posts : 5
Join date : 2014-02-08
Re: how to insert/add record in ms access using vb.net
I try your code but I get like this: Object reference not set to an instance of an object.
chandara- Newbie
- Posts : 1
Join date : 2014-05-03
please help!
hello po,
i saw your video but unfortunately, walang na save sa database ko...
im really wondering bakit gumana ang sayo, i followed all the codes and instructions naman... ang pinalitan ko lang ay ang "name ng database, table, field name and textbox and buttons."
PLEASE... i badly need your help...
i saw your video but unfortunately, walang na save sa database ko...
im really wondering bakit gumana ang sayo, i followed all the codes and instructions naman... ang pinalitan ko lang ay ang "name ng database, table, field name and textbox and buttons."
PLEASE... i badly need your help...
belle123- Newbie
- Posts : 1
Join date : 2014-12-20
Similar topics
» how to delete record in ms access using vb.net
» how to update record in ms access using vb.net
» how to view record in ms access using vb.net
» help me vb.net whent try record in access 2013
» How to connect Ms Access to vb.net
» how to update record in ms access using vb.net
» how to view record in ms access using vb.net
» help me vb.net whent try record in access 2013
» How to connect Ms Access to vb.net
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|