Showing posts with label somebody. Show all posts
Showing posts with label somebody. Show all posts

Wednesday, March 28, 2012

Making small database on iPaq

Hello

I am trying to maintain a small database on my iPAQ, can somebody tell me that would database be created in SQL Server Mobile on my iPaq and can my VB.net based Windows CE application can access data from the database on my iPAQ

tHNAKS

if your iPaq runs Pocket PC 2003 or Windows Mobile 5, then yes, you can create a VB.NET application using Visual Studio 2005 and the .NET Compact Framework 2.0 that can work with data in a SQL Mobile database on your device.

Darren

Monday, March 19, 2012

Make C#

Can somebody help me convert this SQL2000 Function TO C# Function please

CREATE Function dbo.CalculateNextRentDate ( @.Rent_Payment_Date datetime, @.Frequency varchar(50) , @.Number int)

RETURNS DATETIME

AS
begin

DECLARE @.NextPaymentDate Datetime
SET @.Number = @.Number - 1
.
IF @.Frequency = 'month'
IF @.rent_payment_date = dateadd(month, datediff(month, 0+@.Number, @.rent_payment_date) + 1, -1)
BEGIN
SET @.NextPaymentDate = dateadd(month, datediff(month, 0, @.rent_payment_date) + 2, -1)
END
ELSE
BEGIN
SET @.NextPaymentDate = dateadd(month, 1+@.Number, @.rent_payment_date)
END

return @.NextPaymentDate
end

I can't understand why in the T-SQL function it first checks whether the @.Rent_Payment_Date is the last day of the month, so I just remove the check and here is the code:

public DateTime CalculateNextRentDate(DateTime Rent_Payment_Date, string Frequency, int Number)
{
DateTime NextPaymentDate;
NextPaymentDate = Rent_Payment_Date;
Number--;
if (Frequency == "month")
{
NextPaymentDate = Rent_Payment_Date.AddMonths(Number);
}
return NextPaymentDate;
}