Archive for July 15th, 2008

A store procedure for microsoft sql to check win

This procedure use time… month and day

CREATE procedure sp_update_WinHands

@month as  nvarchar(10) ,
@day as nvarchar(10)
as

declare @win as float
declare @lose as float
DECLARE @hand INT
declare @query nvarchar(1000)

declare @check as int

set @check=( select count(tableid) from bethistory where month1=@month and day1= @day)

if ( @check=0 )
begin
insert into bethistory(month1,day1) values (@month,@day)
end

SET @hand = 1
WHILE (@hand <=12)
BEGIN

set @win = (select count(id)  from BetHeader
where datepart(m,dt)=@month and datepart(d,dt)=@day
and case when lasthand>@hand then 1 else 0 end=1)

set @lose = (select count(id)  from BetHeader
where datepart(m,dt)=@month and datepart(d,dt)=@day
and case when lasthand>@hand then 1 else 0 end=0)

if( @win=0 ) begin set @win=1 end

set @query= ‘update  bethistory set h’+cast(@hand as nvarchar(10))+’='+cast(@lose as nvarchar(10))+’.00/’+cast(@win as nvarchar(10))+’.00  where month1=’+@month+’ and day1= ‘+@day+”

exec ( @query )

SET @hand = @hand + 1
END

GO

Add comment July 15, 2008

Check log every 5 min in C#

where timerticlickvoid is the click of the timer….

public void timertickvoid()
{
// Set the timer interval to 5 minutes
timerCheck.Interval = (int)(5 * 1000 * 60);

FileStream fs = File.OpenRead(“timer.log”);
StreamReader sr = new StreamReader(fs);
string myInput = sr.ReadToEnd();
sr.Close();
fs.Close();

DateTime dtFile = Convert.ToDateTime(myInput);

DateTime dt2 = DateTime.Now;

TimeSpan span = dt2.Subtract(dtFile);
int dif = span.Days*60*24 + span.Hours*60+span.Minutes;
if (dif > 5)//>60
{
RunRoutines();
}

}

Add comment July 15, 2008


Archives

Other

Categories

 

July 2008
M T W T F S S
« Jun   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

Tags

.net 1.1 .net 3.0 ADO.NET all-net-news alltechnews author-pinal bsod c# c-sharp controls DataSet datasource dba dba-tool entity-framework Firefox-beta Framework internet-land internet-life java-script jsf mozilla-foundation msbuild online-tools oop php-development php-programming php5 plug-ins query script-land sql-add-on sql-backup-and-restore sql-data-storage sql-datetime sql-query sql-tips-and-tricks sqlauthority-news status-updates t-sql tech-land tech-review Visual Studio 2008 Windows Server xquery