This is code I created to add a record where the user inputs the new
text in textboxes:
Private Sub btnAdd_Click(By Val sender As Object, ByVal e As
System.EventArg s) 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.o ledb.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.OleDbData Adapter(sqlStr, connStr)
dataadapter.Fil l(dt)
dataadapter.Dis pose()
End Sub
When I run the program it stops at dataadapter.Fil l(dt) and gives me
the error message: Security Exception was Unhandled.
Can anyone help me?
Thanks!
text in textboxes:
Private Sub btnAdd_Click(By Val sender As Object, ByVal e As
System.EventArg s) 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.o ledb.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.OleDbData Adapter(sqlStr, connStr)
dataadapter.Fil l(dt)
dataadapter.Dis pose()
End Sub
When I run the program it stops at dataadapter.Fil l(dt) and gives me
the error message: Security Exception was Unhandled.
Can anyone help me?
Thanks!
Comment