you can use short or int for the bit type. In DB any non-zero number will be
converted to 1 and if 0 to 0 appropriately
datetime type you can represent as string "YYYY-MM-DD HH:MM:SS" if you are
executing queries as simple string.
for example
create table test1 (id bigint, value bit, time datetime)
insert into test1 values (1, 0, '2005-01-01 8:35:00')
insert into test1 values (1, -2, '2000-01-01 8:35:00')
insert into test1 values (1, 122, '2000-01-01 8:35:00')
will produce
id value time
1 0 2005-01-01 8:35:00.000
1 1 2000-01-01 8:35:00.000
1 1 2000-01-01 8:35:00.000
"Tom" <ke*****@yahoo.com> wrote in message
news:6F**********************************@microsof t.com...
Hi,
I have a DB table in which has 2 attributes:
1. RegistrationDate datetime
2. IsApproved bit //Approved = 0; Not approve = 1
Now, I need to get and set their values in cs files.
public XXX RegistrationDate / IsApproved
{
get
{
return this.Date; / this.IsApproved;
}
set
{
this.Date = value; / this.IsApproved;
}
}
I want to know what are the data types of datetime and bit in C#?
Do I use string and int for them?
Also, for the datetime, how can I get the system date and time? and what
are their formats? DD/MM/YY SS/MM/HH ?
Thanks for help
Tom