Visual basic.net Datagrid and SQL

JamesBowtell

Member
Joined
Feb 26, 2009
Messages
16
Programming Experience
3-5
Hey

I have a datagrid connected to a table in an SQL compact database. How would I automatically add today’s date in a column when adding a new record?

Cheers
 
You can set the default for the column in SQL Server.

VB.NET:
ALTER TABLE YourTable
ADD CONSTRAINT DF_YourTable_YourColumn
DEFAULT GETDATE() FOR YourColumn

or modify the table in SQL Server Management Studio and set the 'Default Value or Binding' for the column to GETDATE().
 
Back
Top