Dim conn As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim dt As New OleDb.OleDbDataAdapter
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\admin\Documents\Visual Studio 2010\Projects\office software\office software\bin\Debug\Office1.accdb;Persist Security Info=False; "
Try
cmd.Connection = conn
conn.Open()
cmd.CommandText = "insert into Office Values('" & CInt(TBID.Text) & "','" & TBSupplierName.Text & "', " & TBProductName.Text & "," & CInt(TbProductNumber.Text) & "," & CInt(TbProductPrice.Text) & ",conn)"
MsgBox("Data Entered successuflly", MsgBoxStyle.Information)
dt.SelectCommand = cmd
dt.Fill(ds)
conn.Close()
Catch ex As Exception
MsgBox(ex.Message & "Data is Not Entered" & ex.Source, MsgBoxStyle.Critical)
End Try
End Sub
jakeezakiel 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.