About Me

My photo
a Dynamic and Energetic guy.....

Thursday, April 23, 2009

Play with SQL

// getting today
SET @today = CONVERT(CHAR(8), GETDATE(), 112)

//getting first day of month
SELECT DATEADD(DAY, - DATEPART(DAY, CONVERT(CHAR(8), GETDATE(), 112)) + 1, CONVERT(CHAR(8), GETDATE(), 112)) AS firstDay

//getting last day of month
SELECT DATEADD(DAY, - DATEPART(DAY, CONVERT(CHAR(8), GETDATE(), 112)), DATEADD(MONTH, 1, CONVERT(CHAR(8), GETDATE(), 112))) AS lstDay


IF EXISTS

(
SELECT
Date,IsUnblock
FROM
SOSupervisorRemarks
WHERE (Date = '11/30/2009 12:00:00 AM')
)
UPDATE SOSupervisorRemarks SET IsUnblock='False' WHERE Date = '11/30/2009 12:00:00 AM'
ELSE
INSERT INTO SOSupervisorRemarks (Date,IsUnblock) VALUES ('11/30/2009 12:00:00 AM', 'false')


//Getting Date Value from DateTime
dateadd(dd,0, datediff(dd,0,tblSLSale.ExchangeDate)) as ExchangeDate

Monday, April 20, 2009

Apply a style sheet + style class programatically

Finally we were managed to do this(Apply a style sheet programatically ) :)

Table objTable = new Table();

objTable.Attributes.Add("href", "txtstyle.css");
objTable.Attributes.Add("type", "text/css");
objTable.Attributes.Add("rel", "stylesheet");
objTable.Attributes.Add("class", "ph11");

Page.Controls.Add(objTable);


Remember to add tag in "ASPX" page also
<
link
href="txtstyle.css"
rel="stylesheet"
type="text/css"
/>

Friday, April 17, 2009

Tips in Windows Mobile Development

*** It is a scale down version, So you wont get all features as .NET framework
*** You should install .NET Compact framework(3.5) + SQL compact version.

*** Try to use ShowDialog() other than Show()
*** Use Singleton pattern to avoid load many occurances of single form
*** Its easy to user picture/image buttons than menu click
*** Its good to use cursor until data is loading to the form

*** SQL Compact framework doesn't support statements like "IF EXITS"

*** If you want to connect to a Mobile(Compact) DB in ASP.NET add following method
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
this allow you to connect to a DB that has .SDF extension :)


My Masters