T
tony010409020622
Having spent a lot of time Googling over the last 2 days, this seems
like a common problem, but I havent run into any answers:
My VB.Net front end loads data from an Access database successfully,
and navigation works fine. However, I cannot add a record. Code is as
follows:
In my Add New Record button:
REM move to last record
Call btnLast_Click(Nothing, Nothing)
REM clear text boxes, prepare for new record
Me.BindingContext(DsAppointments1, "Appointments").AddNew()
In my Update button:
REM commit to adding new record
Me.BindingContext(DsAppointments1, "Appointments").EndCurrentEdit()
When that last line of code fires, I get the following error (I know
this must be starting to look familiar to experienced coders):
--------------
"An unhandled exception of type 'System.Data.NoNullAllowedException'
occurred in system.data.dll
Additional information: Column 'Appt_ID' does not allow nulls."
--------------
Appt_ID is the primary key and is set to autonumber in the Access
database. I have tried too many things to even mention here, but I
cannot get this to work. I'm sure someone out there has gotten it to
work, and I'd love to know how.
Also, a curiosity. What is the VB.Net equivelent of:
Adodc1.Recordset.Fields(0).Value
Thanks, Tony
like a common problem, but I havent run into any answers:
My VB.Net front end loads data from an Access database successfully,
and navigation works fine. However, I cannot add a record. Code is as
follows:
In my Add New Record button:
REM move to last record
Call btnLast_Click(Nothing, Nothing)
REM clear text boxes, prepare for new record
Me.BindingContext(DsAppointments1, "Appointments").AddNew()
In my Update button:
REM commit to adding new record
Me.BindingContext(DsAppointments1, "Appointments").EndCurrentEdit()
When that last line of code fires, I get the following error (I know
this must be starting to look familiar to experienced coders):
--------------
"An unhandled exception of type 'System.Data.NoNullAllowedException'
occurred in system.data.dll
Additional information: Column 'Appt_ID' does not allow nulls."
--------------
Appt_ID is the primary key and is set to autonumber in the Access
database. I have tried too many things to even mention here, but I
cannot get this to work. I'm sure someone out there has gotten it to
work, and I'd love to know how.
Also, a curiosity. What is the VB.Net equivelent of:
Adodc1.Recordset.Fields(0).Value
Thanks, Tony