J
jtnpham
This is code I created to add a record where the user inputs the new
text in textboxes:
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 = "Provider = Microsoft.Jet.oledb.4.0;"
& "Data Source=F:\Pham\megacities.mdb"
Dim sqlStr As String = "INSERT INTO Cities VALUES('city',
'country', 'p2005', 'p2015')"
Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr, connStr)
dataadapter.Fill(dt)
dataadapter.Dispose()
End Sub
When I run the program it stops at dataadapter.Fill(dt) and gives me
the error message: Security Exception was Unhandled.
Can anyone help me?
Thanks!
text in textboxes:
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 = "Provider = Microsoft.Jet.oledb.4.0;"
& "Data Source=F:\Pham\megacities.mdb"
Dim sqlStr As String = "INSERT INTO Cities VALUES('city',
'country', 'p2005', 'p2015')"
Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr, connStr)
dataadapter.Fill(dt)
dataadapter.Dispose()
End Sub
When I run the program it stops at dataadapter.Fill(dt) and gives me
the error message: Security Exception was Unhandled.
Can anyone help me?
Thanks!