R
Robert Johnson
Hi all. My datasource is a MSSQL 2005 database with several tables all
visable in my datasources tab. I can preview data in the Designer OK so my
connection is fine. Now, I add a form, drag from my datasouce the table and
let VS2005 create a nav bar and grid. Build and run. I can see the data
fine but when I try to add data and press the save Icon I get the folowing
Exception and no data is saved. What am I doing wrong? I must have
something setup incorectly in the database but I can't see what. It's jsut
a simple lookup table with three fields, ID which is an Int that is the PK
and is Identity column, BarrelLgtn a VarChar(50), Comments a VarChar(50).
Thats it, very simple. If you add a row the Identity works as the next value
is indicated but it just will not save and the error is thrown. HELP!!!
Best Regards,
Robert
Me.Validate()
Me.TblBarrelLgthBindingSource.EndEdit()
Me.TblBarrelLgthTableAdapter.Update(Me.Gibbons_SQLDataSet.tblBarrelLgth)
SQL Exception was unhandled came from the last line of code above. and below
is the error:
{"Cannot insert explicit value for identity column in table 'tblBarrelLgth'
when IDENTITY_INSERT is set to OFF."}
visable in my datasources tab. I can preview data in the Designer OK so my
connection is fine. Now, I add a form, drag from my datasouce the table and
let VS2005 create a nav bar and grid. Build and run. I can see the data
fine but when I try to add data and press the save Icon I get the folowing
Exception and no data is saved. What am I doing wrong? I must have
something setup incorectly in the database but I can't see what. It's jsut
a simple lookup table with three fields, ID which is an Int that is the PK
and is Identity column, BarrelLgtn a VarChar(50), Comments a VarChar(50).
Thats it, very simple. If you add a row the Identity works as the next value
is indicated but it just will not save and the error is thrown. HELP!!!
Best Regards,
Robert
Me.Validate()
Me.TblBarrelLgthBindingSource.EndEdit()
Me.TblBarrelLgthTableAdapter.Update(Me.Gibbons_SQLDataSet.tblBarrelLgth)
SQL Exception was unhandled came from the last line of code above. and below
is the error:
{"Cannot insert explicit value for identity column in table 'tblBarrelLgth'
when IDENTITY_INSERT is set to OFF."}