DataBase Timestamp question

M

Mika M

Hi!

My VB.NET 2003 Windows Forms application has components on the form bound to
the dataset datatable. Editing and saving is working fine, but data source
SQL Server's table has column named as "SaveTime", Data Type = datetime, and
Default Value is (getdate()). It's bound to TextBox, and TextBox's
ReadOnly-property=True. I want to show only save time on the form, but how
can I set this database's time automatically when it's bound to TextBox.

I bound it this way...

txtSaveTime.DataBindings.Add(New Binding("Text", dt, "SaveTime"))

My problem is when new line is saved into SQL Server's table using
DataAdapters update-mothod, SQL Server's table's column named as "SaveTime"
is NULL! I would like to use database's time because workstation client time
may not be correct always.
 
C

CT

Is there a reason why you allow NYULL values in this column, i.e. do you not
require this value whenever a row is added? If so, changing the nullable
attribute of the column should do the trick.
 
M

Mika M

CT said:
Is there a reason why you allow NYULL values in this column, i.e. do you
not require this value whenever a row is added? If so, changing the
nullable attribute of the column should do the trick.

Oh boys! It's working without changing application after I changed NULLs are
not allowed in this "SaveTime" column in database table :) ... why didn't I
discovered so simple thing by myself :(
 
C

CT

You know, it's quite often the little things that results in endless hair
pulling; it's the infamous 80/20 rule; the last 20 percent takes 80 percent
of the time...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top