I am learning vb express. I started with 2008 a week ago and have just imported a test project into 2010 which I have just downloaded. The import produced no errors.
I am using an access database with the OleDB provider to read a single table into a DataAdapter using example tutorial code.
Under 2008 everything was fine in debug mode, I can display and edit and save the data back to the database.
After importing into 2010 all seemed the same until I tried to save. My save button click event code is similar to:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If m_dtCustomers.Rows.Count <> 0 Then
m_dtCustomers.Rows(m_rowPosition)("ID") = txtID.Text
m_dtCustomers.Rows(m_rowPosition)("Company") = txtCompany.Text
m_dtCustomers.Rows(m_rowPosition)("Address1") = txtAddress1.Text
m_dtCustomers.Rows(m_rowPosition)("Contact") = txtContact.Text
This worked perfectly in 2008 but not in 2010 as I get an exception on the update line saying there is a syntax error.
The form class declarations are:
Private m_cnADONetConnection As New OleDb.OleDbConnection()
Private m_daDataAdapter As OleDb.OleDbDataAdapter
Private m_cbCommandBuilder As OleDb.OleDbCommandBuilder
Private m_dtCustomers As New DataTable
and the form load event:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
m_cnADONetConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\visual_basic_tests\test1.mdb"
m_daDataAdapter = New OleDb.OleDbDataAdapter("Select * From Customers", m_cnADONetConnection)
m_cbCommandBuilder = New OleDb.OleDbCommandBuilder(m_daDataAdapter)
I haven't shown the code for displaying the record as it is just basic stuff.
Can anyone advise, as I don't know where to go from here. Has 2010 changed anything?