Tag - trending

Create SSIS Data Flow Task Package Programmatically
Jul 27, 2020

In this article, we will review how to create a data flow task package of SSIS in Console Application with example. Requirements Microsoft Visual Studio 2017 SQL Server 2014 SSDT Article  Done with the above requirements? Lets start by launching Microsoft Visual Studio 2017. Create a new Console Project with .Net Core.  After created new project provide proper name to it. In Project Explorer import relevant references and ensure that you have declared namespaces as below: using Microsoft.SqlServer.Dts.Pipeline.Wrapper; using Microsoft.SqlServer.Dts.Runtime; using RuntimeWrapper = Microsoft.SqlServer.Dts.Runtime.Wrapper;   To import above namespaces we need to import below refrences.   We need to keep in mind that, above all references should have same version.   After importing namespaces, ask user for the source connection string, destination connection string and table that will be copied to destination. string sourceConnectionString, destinationConnectionString, tableName; Console.Write("Enter Source Database Connection String: "); sourceConnectionString = Console.ReadLine(); Console.Write("Enter Destination Database Connection String: "); destinationConnectionString = Console.ReadLine(); Console.Write("Enter Table Name: "); tableName = Console.ReadLine();   After Declaration, create instance of Application and Package. Application app = new Application(); Package Mipk = new Package(); Mipk.Name = "DatabaseToDatabase";   Create OLEDB Source Connection Manager to the package. ConnectionManager connSource; connSource = Mipk.Connections.Add("ADO.NET:SQL"); connSource.ConnectionString = sourceConnectionString; connSource.Name = "ADO NET DB Source Connection";   Create OLEDB Destination Connection Manager to the package. ConnectionManager connDestination; connDestination= Mipk.Connections.Add("ADO.NET:SQL"); connDestination.ConnectionString = destinationConnectionString; connDestination.Name = "ADO NET DB Destination Connection";   Insert a data flow task to the package. Executable e = Mipk.Executables.Add("STOCK:PipelineTask"); TaskHost thMainPipe = (TaskHost)e; thMainPipe.Name = "DFT Database To Database"; MainPipe df = thMainPipe.InnerObject as MainPipe;   Assign OLEDB Source Component to the Data Flow Task. IDTSComponentMetaData100 conexionAOrigen = df.ComponentMetaDataCollection.New(); conexionAOrigen.ComponentClassID = "Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter, Microsoft.SqlServer.ADONETSrc, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"; conexionAOrigen.Name = "ADO NET Source";   Get Design time instance of the component and initialize it. CManagedComponentWrapper instance = conexionAOrigen.Instantiate(); instance.ProvideComponentProperties();   Specify the Connection Manager. conexionAOrigen.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(connSource); conexionAOrigen.RuntimeConnectionCollection[0].ConnectionManagerID = connSource.ID;   Set the custom properties. instance.SetComponentProperty("AccessMode", 0); instance.SetComponentProperty("TableOrViewName", "\"dbo\".\"" + tableName + "\"");   Reinitialize the source metadata. instance.AcquireConnections(null); instance.ReinitializeMetaData(); instance.ReleaseConnections();   Now, Add Destination Component to the Data Flow Task. IDTSComponentMetaData100 conexionADestination = df.ComponentMetaDataCollection.New(); conexionADestination.ComponentClassID = "Microsoft.SqlServer.Dts.Pipeline.ADONETDestination, Microsoft.SqlServer.ADONETDest, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"; conexionADestination.Name = "ADO NET Destination";   Get Design time instance of the component and initialize it. CManagedComponentWrapper instanceDest = conexionADestination.Instantiate(); instanceDest.ProvideComponentProperties();   Specify the Connection Manager. conexionADestination.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(connDestination); conexionADestination.RuntimeConnectionCollection[0].ConnectionManagerID = connDestination.ID;   Set the custom properties. instanceDest.SetComponentProperty("TableOrViewName", "\"dbo\".\"" + tableName + "\"");   Connect the source to destination component: IDTSPath100 union = df.PathCollection.New(); union.AttachPathAndPropagateNotifications(conexionAOrigen.OutputCollection[0], conexionADestination.InputCollection[0]);   Reinitialize the destination metadata. instanceDest.AcquireConnections(null); instanceDest.ReinitializeMetaData(); instanceDest.ReleaseConnections();   Map Source input Columns and Destination Columns foreach (IDTSOutputColumn100 col in conexionAOrigen.OutputCollection[0].OutputColumnCollection) {     for (int i = 0; i < conexionADestination.InputCollection[0].ExternalMetadataColumnCollection.Count; i++)     {         string c = conexionADestination.InputCollection[0].ExternalMetadataColumnCollection[i].Name;         if (c.ToUpper() == col.Name.ToUpper())         {             IDTSInputColumn100 column = conexionADestination.InputCollection[0].InputColumnCollection.New();             column.LineageID = col.ID;             column.ExternalMetadataColumnID = conexionADestination.InputCollection[0].ExternalMetadataColumnCollection[i].ID;         }     } }   Save Package into the file system. app.SaveToXml(@"D:\Workspace\SSIS\Test_DB_To_DB.dtsx", Mipk, null);   Execute package. Mipk.Execute(); Conclusion In this article, we have explained one of the alternatives for creating SSIS packages using .NET console application. In case you have any questions, please feel free to ask in the comment section below.

5 Ways Your Business Can Benefit from Negative Reviews
Oct 01, 2019

So, you’ve somehow received a couple of bad online reviews. Is your business doomed? Certainly not! Even big brands have had their fair share of angry outpour from disgruntled customers and survived. While larger companies’ reputations can sustain a few blows without actually collapsing, small businesses can’t rely on the benefit of the doubt to amortize customers’ wrath as effectively. But you should actually be grateful for bad reviews, as they help your business grow. one out of twenty unhappy customers complain, and the other 19 leave without telling you “why.” This gives you no opportunity to learn from your mistakes or fix what’s broken. In fact, most brands hear feedback from less than one percent of their customer base. But we know that customer feedback is absolutely critical, and that we need to be gathering it at the right times and places. Negative feedback is like pain – it’s a warning that there’s something wrong and that you should do something about it. Without bad reviews, you’d be resting on your laurels while your business is crumbling and your customers fleeing. Here’s how you can benefit from these negative experiences and turn them into wins. 1. Own Your Mistakes The worst thing you can do upon receiving a bad review is turning a blind eye, trying to cover the problem up, or being hostile towards the customer who complained. Any of these approaches can hurt your reputation more than the negative customer experience itself. Even if the review is exaggerated and vicious, you shouldn’t try to “get even.” It’s crucial to always be polite, civil, and promise that you’ll look into the matter as soon as possible. By taking responsibility, you show that you’re willing to change and improve your customer experience, and owning up to your mistakes can be excellent PR. Texaco, one of the world’s biggest petroleum companies, was sued by former employees and accused of racial discrimination back in 1994. Instead of offering them hush money, Texaco took a totally different approach. The company’s CEO publicly apologized, while executives traveled to every office location to apologize in person. Finally, hiring an African-American-owned advertising agency to do its upcoming campaign was the crowning touch. 2. Show Your Customers You Care Business lost $75 Billion in 2018 because of poor customer service. If you ignore customer complaints, you’ll paint your business in a negative light. But if you carefully monitor what your customers are saying both to your customer service reps and in their online reviews, and respond to them, you show that their opinion matters. There’s another stat which illustrates the importance of handling customer complaints properly – people who have their issue solved during the first interaction with a company are two times more likely to purchase from the same. In order to ensure top-notch customer service, it’s a good idea to implement chatbots. These smart algorithms are like first responders in case of an emergency , and unlike your customer service reps who can’t be online and available 24/7, chatbots can: and they can offer troubleshooting and answers to some of the most common questions. They can collect your customers’ complaints and help you identify the problem. 3. Respond in a Timely Manner In 2014, General Motors faced a huge crisis after faulty ignition switches caused 124 deaths. The company had to recall 2.6 million vehicles over the first three months of the year. It would be an understatement to say that their customers were unhappy. Many of them took to social media to express their dissatisfaction, and G.M.’s social media team jumped in to save the day and the company’s reputation. Not only did the company respond to each and every message across different social media channels, it also provided their customers with immediate help by paying for replacement vehicles and covering the other expenses incurred as a result of the issues they had with their cars. But in order to be able to respond in a timely manner, you need to be aware of an upcoming PR disaster, and social listening is a strategy which allows you to track every mention of your brand, products, and keywords on different channels and spot the issue before it snowballs into a full-fledged PR armageddon. 4. Encourage Online Reviews Now that we’ve established that you won’t be able to save yourself from negative feedback (nor should you try to do so), it’s important to mention that you can always balance the scales with positive reviews. Many companies ask for online reviews directly and encourage their happy users to share their experiences with others. This can partially neutralize any negative review that throws shade on your business. Promote your customers at right time and place, within your app to boost five-star ratings. You can solicit positive reviews from people who love your app and intercept (and stop) negative feedback from unhappy customers. 5. Correct Your Mistake and Promote Changes Once you fix product bugs or resolve a particular issue that a customer had with your company, you shouldn’t be silent about it. Revisit all the negative reviews, describe what you’ve done to fix things, and encourage your unhappy customers to see it for themselves. To illustrate the point, let’s talk about another automotive behemoth who was involved in a scandal. In 2010, Toyota had to recall 8.8 million vehicles due to safety defects. Although the company’s initial response was slow and clunky, it managed to justify its previously impeccable reputation in terms of customer service and product quality by fixing the issue and offering extended warranties. Apart from that, the company’s marketing strategy revolved around its attempts to fix issues and convinced its customers that they didn’t have a reason to worry about safety. As you can see, negative customer experiences and bad online reviews don’t have to turn into a kiss of death. If you leverage the right problem-solving strategies and an honest and responsible approach, you can even benefit from the wrath of an occasional unhappy customer.