Hi can i ask someone on how to easily display the content of my database using dataGridView, I already managed to update the inputted datas into the database. can you also give me some tips on my project.
I am using access as My database
Imports System.Data.OleDb
Imports System.Data
Public Class stor
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Validate()
Me.StorBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Database7DataSet)
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox("Please Complete all the Information")
Else
Try
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Gui\Documents\Database7.accdb;")
Dim insert As String = "Insert into stor values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "');"
Dim cmd As New OleDbCommand(insert, conn)
conn.Open()
cmd.ExecuteNonQuery()
MsgBox("create success")
Catch ex As Exception
MsgBox("error")
End Try
End If
End Sub
Private Sub stor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database7DataSet.stor' table. You can move, or remove it, as needed.
Me.StorTableAdapter.Fill(Me.Database7DataSet.stor)
End Sub
End Class