Search code examples
c#.netdatabasedatabase-designoledb

Autoincreament in OLEDB And Datagridview Records Viewing


What can be alternative if i want to use autoincreament facility in oledb database (Microsoft Access DB)...i now autonumber datatype is there in it...but it does not work like autoincreament faciity in SQL Server 2008 r2...

And

I have installed one simple c# application on my client's machine....where in client does the data entry and after submitting it gets viewed in Datagrid...

Eg.I have made form for entering Id(Autogenerating it through program),Name,Address,Mobile,Landline.

When operator fills these details and clicks on submit button it gets stoed in database and is viewd in datagridview(As it is bound with corrosponding table in database)

..........Problem here is that..operator has now entered more than 50 records and datagridview has suddeny started showing the records from 22nd to 50th and after 50th record 1st to 21st record..

Each time the new record is added it gets appended after 50th record... I am using microsoft access database over here(OLEdB connections)... I have never faced these kind of problems when i used Microsoft SQL Server r2...

What can be the solution...

Code which i have written to bind the Datagridview is as follows>>>

da=new oledbdataadapter("select * from customer",con);
Dataset ds=new Dataset();
da.fill(ds);
gvCustomerRecord.Datasource=ds.Tables[0];

is there any solution on autoincreament in OLEDB???


Solution

  • You can use Order By on CustomerID