UnumPhenomenous UnumPhenomenous - 2 years ago 71
Vb.net Question

Access database connecting to VS but no data showing and runtime error

Trying to use an access database with Visual studio 15. After failure I found a number of tutorials and followed them with a new project and new database.

The database is connecting but the data inside the database won't display (although no error) and even using the built in save function in VB results in a run time error.

If anyone can point me in the right direction I'd be grateful. Code below.

Public Class Form1
Private Sub CustomersBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles CustomersBindingNavigatorSaveItem.Click

Me.TableAdapterManager.UpdateAll(Me.CustomersDataSet) 'Error is here****

End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CustomersDataSet.Customers' table. You can move, or remove it, as needed.

End Sub

Private Sub BindingNavigatorDeleteItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorDeleteItem.Click

End Sub

Private Sub BindingNavigatorAddNewItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorAddNewItem.Click

End Sub
End Class

The error message I get is An unhandled exception of type
'System.Data.OleDb.OleDbException' occurred in System.Data.dll

Additional information: Unspecified error.

Answer Source

Here is a video that I made a while ago that should be able to help you,
If you have any questions about it, i can definitely help you out.

Also do you definitely need to use Access? I would recommend using an SQL database because when you publish your program, the end user may have to have a link to your access database in the same spot as yours, which can be a pain.

Nevertheless here is a video i also made regarding setting up an SQL database via Visual Studio. https://www.youtube.com/watch?v=NLs44hxV514

If you have any issue, leave a comment and i will be happy to help you out :)

Keep In Mind
Don't forget that you need to also have a Number/unique word/or something a like in the Primary key column even if you haven't added any details to the database. eg Name and so on. If not your program may crash, so you could use the Try statement to fix this issue if the Primary Key column is left empty.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download