question

LanceSummers-4763 avatar image
0 Votes"
LanceSummers-4763 asked LanceSummers-4763 edited

BindingSource.AddNew does not AutoIncrement

VideoTableBindingSource.AddNew() does not auto increment I get an error stating that the ID Column may not be null I have the following defined in my Database: [Id] INT NOT NULL Primary Key Identity (1,1), clicking on ID shows Is Identity True in the properties window VideoTableBindingSource Datamember is set to VideoTable that contains ID as the primary key I even tried Me.VideoDBDataSet1.VideoTable.IdColumn.AutoIncrement = True before the AddNew() call but I get the same results Any help would be greatly appriciated, I am using Visual Studio 2017 VB. Lance

office-vba-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

 Private Sub AddDataToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AddDataToolStripMenuItem.Click
     Me.VideoDBDataSet.VideoTable.IdColumn.AutoIncrement = True
     VideoDBDataSetBindingSource.AddNew()
 End Sub


CREATE TABLE [dbo].[VideoTable] (
[Id] INT NOT NULL Primary Key Identity (1,1),
[RecDVD] BIT NULL,



'This is the Code that calls AddNew and the Table's SQL definision


Created an Access Database file and referenced it in the DataGridView
to fix this problem. The AddNew call works with the New Database.

0 Votes 0 ·

0 Answers