Click here to Skip to main content
14,926,216 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi to all,

First of all sorry for me English

I have post 2 or 3 times older with the same subject but i don't find any answer that i can handle.

I have a database in access and i want to create some datagridview but is all the same.
My problem is in my tables i don’t have an auto increment number and in any add i have to found the key myself (max(key)) and in my last field i have to write the system date.

I have create a datagridview but when i try to add a new record i don’t knew how to insert the max of the key and the system date in my last field and the result is to get an error.

PLEASE help me....
I want in any add new record to find a way to insert in the new record the key and the system date before the insert finish.

Because i am new in VB i would like to be more specific.

If someone is able to write some core in VB this will be great.

My table is movement_roller_h and the field is
movement_roller_h_doc - key required yes
movement_roller_h_date - date/time required yes
movement_roller_h_typekkin_id - string required yes
movement_roller_h_text - string required yes
movement_roller_h_date_create - date/time required yes

Thanks a lot for your time.
Posted
Updated 25-Apr-11 10:13am
v2
Comments
Tarakeshwar Reddy 25-Apr-11 16:13pm
   
Removed pre tags

1 solution

You need to handle the DefaultValuesNeeded.aspx[^] event.

In the handler set the
VB
e.Row.Cells["nameOfYourKeyCell"].Value = 'Do your Max(key) thing here
e.Row.Cells["nameOfYourDateCell"].Value = DateTime.Now.ToString()
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900