Showing posts with label provided. Show all posts
Showing posts with label provided. Show all posts

Thursday, March 22, 2012

Calculate Weekending date.

Can someone help me with this. I need to calculate the week ending
date of the first week of the year based upon a year provided by the
user. Is there a simpler way other than writing my own UDF?"David" <david.paskiet@.t-mobile.com> wrote in message
news:9abbaed9.0411160734.1d9c021f@.posting.google.c om...
> Can someone help me with this. I need to calculate the week ending
> date of the first week of the year based upon a year provided by the
> user. Is there a simpler way other than writing my own UDF?

That depends on what week ending date and first week of the year mean.

If 1 Jan is on Wednesday do you want to come back with 4 Jan, 5 Jan, 11 Jan
or 12 Jan?

Anyway, Generally, the last day of a week is Date +7 - Day(Date) where Day()
returns the number of the day in the week (1=Sun, 2=Mon, 3=Tue,
etc...Assuming the week starts on Sunday)

Therefore DateAdd(d,-DatePart(dw,datefield),DateAdd(d,7,datefield))

However, if the datefield contains a time you may want to change the time if
you are using this in a comparison.

Regards,
Jim

Sunday, February 19, 2012

C# : failed due to the following error: 80040154

When i execute the following code provided by msdn, it shows error on the line Application app = newApplication().

But i got some comments that it works fine in 64-bit machine. Could you please help me out. Thanks in advance.

Executed Code

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.SqlServer.Dts.Runtime;

namespace Connections_Collection

{

classProgram

{

staticvoid Main(string[] args)

{

// The package is one of the SSIS Samples.

string mySample = @."C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";

// Create an application and load the sample.

Application app = newApplication();

Package pkg = app.LoadPackage(mySample, null);

Connections myConns = pkg.Connections;

int connCount = myConns.Count;

Console.WriteLine("The number of connections in the package is: {0}", connCount);

// Enumerate over the collection, printing out

// the values for various properties.

foreach (ConnectionManager connMgr in myConns)

{

Console.WriteLine("ConnectionString: {0}", connMgr.ConnectionString);

Console.WriteLine("CreationName: {0}", connMgr.CreationName);

Console.WriteLine("DelayValidation: {0}", connMgr.DelayValidation);

Console.WriteLine("Description: {0}", connMgr.Description);

Console.WriteLine("HostType: {0}", connMgr.HostType);

Console.WriteLine("ID: {0}", connMgr.ID);

Console.WriteLine("InnerObject: {0}", connMgr.InnerObject);

Console.WriteLine("Name: {0}", connMgr.Name);

Console.WriteLine("ProtectionLevel: {0}", connMgr.ProtectionLevel);

Console.WriteLine("SupportsDTCTransactions: {0}", connMgr.SupportsDTCTransactions);

}

Console.WriteLine("");

}

}

}

Error message

Retrieving the COM class factory for component with CLSID {E44847F1-FD8C-4251-B5DA-B04BB22E236E} failed due to the following error: 80040154.

Thanks,
Kalam

I am also facing the same problem. Can anybody help on this?

the Code works fine in a 32 bit machine but shows this on a 64 bit machine.

Any idea?

Thanks in advance

|||Try to upload the DTS from a 32 bit machine onto the 64 bit and probably it should work...|||Could you elaborate on this solution please ("upload the DTS")? What is involved with uploading DTS onto Windows Vista Business 64-bit? I also get the same error message for a program running in 64-bit mode that is trying to call a 32-bit DLL. Thanks.

C# : failed due to the following error: 80040154

When i execute the following code provided by msdn, it shows error on the line Application app = new Application().

But i got some comments that it works fine in 64-bit machine. Could you please help me out. Thanks in advance.

Executed Code

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.SqlServer.Dts.Runtime;

namespace Connections_Collection

{

class Program

{

static void Main(string[] args)

{

// The package is one of the SSIS Samples.

string mySample = @."C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";

// Create an application and load the sample.

Application app = new Application();

Package pkg = app.LoadPackage(mySample, null);

Connections myConns = pkg.Connections;

int connCount = myConns.Count;

Console.WriteLine("The number of connections in the package is: {0}", connCount);

// Enumerate over the collection, printing out

// the values for various properties.

foreach (ConnectionManager connMgr in myConns)

{

Console.WriteLine("ConnectionString: {0}", connMgr.ConnectionString);

Console.WriteLine("CreationName: {0}", connMgr.CreationName);

Console.WriteLine("DelayValidation: {0}", connMgr.DelayValidation);

Console.WriteLine("Description: {0}", connMgr.Description);

Console.WriteLine("HostType: {0}", connMgr.HostType);

Console.WriteLine("ID: {0}", connMgr.ID);

Console.WriteLine("InnerObject: {0}", connMgr.InnerObject);

Console.WriteLine("Name: {0}", connMgr.Name);

Console.WriteLine("ProtectionLevel: {0}", connMgr.ProtectionLevel);

Console.WriteLine("SupportsDTCTransactions: {0}", connMgr.SupportsDTCTransactions);

}

Console.WriteLine("");

}

}

}

Error message

Retrieving the COM class factory for component with CLSID {E44847F1-FD8C-4251-B5DA-B04BB22E236E} failed due to the following error: 80040154.

Thanks,
Kalam

I am also facing the same problem. Can anybody help on this?

the Code works fine in a 32 bit machine but shows this on a 64 bit machine.

Any idea?

Thanks in advance

|||Try to upload the DTS from a 32 bit machine onto the 64 bit and probably it should work...|||Could you elaborate on this solution please ("upload the DTS")? What is involved with uploading DTS onto Windows Vista Business 64-bit? I also get the same error message for a program running in 64-bit mode that is trying to call a 32-bit DLL. Thanks.

C# : failed due to the following error: 80040154

When i execute the following code provided by msdn, it shows error on the line Application app = new Application().

But i got some comments that it works fine in 64-bit machine. Could you please help me out. Thanks in advance.

Executed Code

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.SqlServer.Dts.Runtime;

namespace Connections_Collection

{

class Program

{

static void Main(string[] args)

{

// The package is one of the SSIS Samples.

string mySample = @."C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";

// Create an application and load the sample.

Application app = new Application();

Package pkg = app.LoadPackage(mySample, null);

Connections myConns = pkg.Connections;

int connCount = myConns.Count;

Console.WriteLine("The number of connections in the package is: {0}", connCount);

// Enumerate over the collection, printing out

// the values for various properties.

foreach (ConnectionManager connMgr in myConns)

{

Console.WriteLine("ConnectionString: {0}", connMgr.ConnectionString);

Console.WriteLine("CreationName: {0}", connMgr.CreationName);

Console.WriteLine("DelayValidation: {0}", connMgr.DelayValidation);

Console.WriteLine("Description: {0}", connMgr.Description);

Console.WriteLine("HostType: {0}", connMgr.HostType);

Console.WriteLine("ID: {0}", connMgr.ID);

Console.WriteLine("InnerObject: {0}", connMgr.InnerObject);

Console.WriteLine("Name: {0}", connMgr.Name);

Console.WriteLine("ProtectionLevel: {0}", connMgr.ProtectionLevel);

Console.WriteLine("SupportsDTCTransactions: {0}", connMgr.SupportsDTCTransactions);

}

Console.WriteLine("");

}

}

}

Error message

Retrieving the COM class factory for component with CLSID {E44847F1-FD8C-4251-B5DA-B04BB22E236E} failed due to the following error: 80040154.

Thanks,
Kalam

I am also facing the same problem. Can anybody help on this?

the Code works fine in a 32 bit machine but shows this on a 64 bit machine.

Any idea?

Thanks in advance

|||Try to upload the DTS from a 32 bit machine onto the 64 bit and probably it should work...