Tuesday, September 17, 2013

Format String For Dates

d - Numeric day of the month without a leading zero.
dd - Numeric day of the month with a leading zero.
ddd - Abbreviated name of the day of the week.
dddd - Full name of the day of the week.

f,ff,fff,ffff,fffff,ffffff,fffffff -
Fraction of a second. The more Fs the higher the precision.

h - 12 Hour clock, no leading zero.
hh - 12 Hour clock with leading zero.
H - 24 Hour clock, no leading zero.
HH - 24 Hour clock with leading zero.

m - Minutes with no leading zero.
mm - Minutes with leading zero.

M - Numeric month with no leading zero.
MM - Numeric month with a leading zero.
MMM - Abbreviated name of month.
MMMM - Full month name.

s - Seconds with no leading zero.
ss - Seconds with leading zero.

t - AM/PM but only the first letter.
tt - AM/PM ( a.m. / p.m.)

y - Year with out century and leading zero.
yy - Year with out century, with leading zero.
yyyy - Year with century.

zz - Time zone off set with +/-.

Saturday, September 7, 2013

Difference between DataReader, DataTable and DataSet

DataReader
1. Its an connection oriented, whenever you want fetch the data from database that you need the connection. after fetch the data connection is diconnected. 
2. Its an Read only format, you cann't update records. 

DataSet
1. Its connectionless. whenever you want fetch data from database. its connects indirectly to the database and create a virtual database in local system. then disconnected from database.
2. Its easily read and write data from virtual database.

DataTable
A DataTable object represents a single table in the database. It has a name rows and columns.
There is not much difference between dataset and datatable, dataset is just the collection of datatables.