My question has to do with the connection between these two. Right
now on the userform I have textboxes for the user to input values.
What I want to do is to have buttons with the names of ADD Record,
MODIFY Record, and DELETE Record.
I don't know how to connect with the database in MS ACCESS and edit
it
accordingly with the textboxes. I know how to do it using a
DataGridView, though.
I've done research and saw SQL statements for each button action, but
when I enter that in my boilerplate nothing happens.
For EXAMPLE:
Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
City = txtCity.Text
Country = txtCountry.Text
p2005 = txt2005.Text
p2015 = txt2015.Text
Dim dt As New DataTable()
Dim connStr As String = "Proficer = Microsoft.Jet.oledb.4.0;"
& "Data Source=F:\Pham\megacities.mdb"
Dim sqlStr As String = "INSERT INTO Cities VALUES(city,
country, p2005, p2015)"
'Would it be okay to have this as my SQL string?:
'"INSERT INTO Cities VALUES(txtCity.text, txtCountry.text,
txt2005.text, txt2015.text)"
Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr,
connStr)
dataadapter.Fill(dt)
dataadapter.Dispose()
Can anyone help? Or have suggestions?
Thanks! =)