Access support auto number in table field data type as double. While using access databasedirect there is no need to provide autonumber data, Access automatically generate it.
It is good for direct working with Access but what about if you’re making a project and want to add record through some programming language like VB.net then it creates many types of problems. Details are following
- If attempt to insert empty value like direct working, does not support
- If a constant is provide every time then there is not any importance of autonumber because we are not using its actual uses because auto generate number minimize the programmer manual work by automate unique number entry to every time
You can use SQL solution which enable us to skip some input Value by providing field details take a look
Insert into student (ROLL,Name,city) values(101,’sona’,’varanasi’);
this query enable you to add only specified value through field if table has more fields then it would fill with NULL. I am using same approach for accomplish it through following program
Code :Dim con As New OleDbConnection(kacls.getConString)
Dim com As New OleDbCommand
com.Connection = con
com.CommandText = "insert into tmp (sname) values('" & TextBox3.Text & "')"