Thursday, November 10, 2011

.NET User Group: iPhone Application Development for .NET Junkies

Did my first presentation at the .NET User Group yesterday on Developing iPhone Applications using .NET (C# and MonoTouch).

Really encouraging feedback and comments.

Slides: iPhone Application Development for .NET Junkies

Thursday, November 03, 2011

SSIS SQL Task - “Parameter name is unrecognized”


You tried to set up a SSIS SQL Task and also assigned a parameter to that.

Make sure that you changed the Parameter name from 'NewParameterName' to 0.

Sunday, July 31, 2011

Wednesday, July 20, 2011

The setup routines for the Lotus NotesSQL Driver(*.nsf) ODBC driver could not be loaded due to system error code 126.

I tried to create a system DSN for ODBC connection to the Lotus Notes Database and I got the following error:

"The setup routines for the Lotus NotesSQL Driver(*.nsf) ODBC driver could not be loaded due to system error code 126."

Just append the Lotus Installation Path to the Path environment variable and try setting up the DSN again and it will work.

Tuesday, July 12, 2011

Variable: not found in bash script

I was trying to assign a value to a variable using bash script and got this error.


You can't have space around the "=" sign. Remove the space around the equal to sign and run the script.

Thursday, June 23, 2011

OLE DB provider "VFPOledb.1" has not been registered

I was trying to create a Linked Server on SQL SERVER 2008 R2 Server to connect to Foxpro database on a Windows 7 PC. I installed the Visual FoxPro 9.0 OLE DB provider and when I accessed the linked server, I got the above error.


Un-install the Visual FoxPro 9.0 OLE DB provider
Install the Provider for all users instead of current user and it will fix the problem.

Thursday, May 26, 2011

Cannot convert lambda expression to type 'string' because it is not a delegate type

Got this odd error and but not so meaningful.


Just include the Linq namespace that will fix the error.

using System.Linq;

Sunday, May 22, 2011

The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as ‘Allowed’ or ‘Required’

If you get this error when you try to run a WCF Rest Service, then add the following line above the class declaration

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Class1 : IService1

This is because ASP.NET Compatibility Mode implies request processing semantics that are fundamentally different from the WCF default, individual service implementations have the ability to control whether they run inside of an application for which ASP.NET Compatibility Mode has been enabled. Services can use the AspNetCompatibilityRequirementsAttribute to indicate whether they support ASP.NET Compatibility Mode

Tuesday, February 22, 2011

ODBC error 208 (42S02) Invalid object name


You may get this error even though the table is available in the database.


Using qualified table name "database.owner.table" will fix this issue.

Friday, February 11, 2011

How to create XSD file path as expression for XML Source in SSIS

In your CONTROL FLOW tab, select the data flow step that contains the XML Source step. Do not go into the dataflow, it must be done in control flow.

1. Bring up its properties (right-click > Properties)
2. Click the elipsis button next to EXPRESSIONS
3. Select the [XML Source].[XMLSchemaDefinition] property then hit the elipsis button to the right of the Expression textbox to set the XSD File path
4. Drag and Drop your variable that holds your XSD path into the expression box, you should be able to evaluate expression here.
5. Click OK
6. Click OK again
7. Done

SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

Check the following and fix the issue accordingly.

1) Make sure your server name is correct, e.g., no typo on the name.
2) Make sure your instance name is correct and there is actually such an instance on your target machine. [Update: Some application converts \\ to \. If you are not sure about your application, please try both Server\Instance and Server\\Instance in your connection string]
3) Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
4) Make sure SQL Browser service is running on the server.
5) If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.
6) Also check whether TCP/IP is enabled and the port is added to the firewall exception (if it is not using the default 1433 port)

You can download PortQry from, run "portqry.exe -n yourservername -p UDP -e 1434". If this command returns information and it contains your target instance, then you can rule out possiblity 4) and 5) above, meaning you do have a SQL Browser running and your firewall does not block SQL Browser UDP packet. In this case, you can check other issue, e.g. wrong connection string.

Failed to load expression host assembly. Details: Could not load file or assembly 'expression_host_f7d608c0ebb24f48bac018b81c6ff665, Version=11.2.30319.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)

This error normally occurs if you try to use the Report Viewer control or local RDLC reports.

This is because RDLC or Report Viewer control requires the website to run in Full trust mode.

MS Response

This issue is by design. Local mode requires full trust. The main reason for it is because local mode processing and rendering engine are hosted with the viewer and those operations demand full trust.

The EntityContainer name must be unique. An EntityContainer with the name 'xxxxx' is already defined.

This issue arises if you have two models in a project that have the same schema.

Even if you delete the one of the model, make sure that the reference to the original assembly that is still in the client application's BIN folder is deleted to fix this error.

Entity Framework was attempting to load the metadata files from both assemblies and detected the conflict.

Cleaning the project didn't fix the problem. The leftover assembly was still there.. that had to be deleted (dll and pdb file manually)

Tuesday, February 08, 2011

The base class includes the field 'ReportViewer1', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer)

This error normally occurs when different versions of Microsoft.ReportViewer.WebForms.dll are referenced in web.config and in controls.

Clean the solution and delete the related dll files and then again rebuild the solution

The report definition is not valid. Details: The report definition has an invalid target namespace '' which cannot be upgraded.

You may get the above error when trying to view a RDLC report using with the VS 2005 or VS 2008 viewer controls with 2008 schema.

When using local mode, you are using the same report processing engine that was shipped with SQL Server 2005. This engine does not understand the new report definition schema and attempting to load a report created with one of the new SQL Server 2008 authoring tools will result in this error.

Open the RDLC in VS2010 and use the v10 of the report viewer control to run the report.

How to get files to the Miscellaneous folder in SSIS project?

Right click on the SSIS project and click on Add -> Existing Item and navigate to any file that you’d like to add to the project.

Files of a different type than the usual SSIS files such as .dtsx and .ds are automatically added under the Miscellaneous folder.

When adding files, they will be automatically copied to the SSIS project folder, no matter where they were stored originally.

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

If you get the above error, the reason would be the connection string information is not provided by the Client using the Entity framework.

Add/Update the connection string and try again.

Entity framework and calling a stored procedure

Calling a stored procedure using Entity Framework without adding the stored procedure to the Designer.


RDL - RDL stands for Report Definition Language

RDLC - Report Definition Language Client-side processing

RDL files are created by the SQL Server 2008 version of Report Designer. RDLC files are created by the Visual Studio 2008 version of Report Designer.

RDL and RDLC formats have the same XML schema. However, in RDLC files, some values (such as query text) are allowed to be empty, which means that they are not immediately ready to be published to a Report Server. The missing values can be entered by opening the RDLC file using the SQL Server 2008 version of Report Designer. (You have to rename .rdlc to .rdl first.)

Friday, January 07, 2011

Dynamic Sheet Name in SSIS Excel Spreadsheet imports


I had to import excel data (just one sheet) into SQL database. The excel spreadsheet had multiple sheets where I am interested in only one sheet.


a) Create a new SSIS variable named "SheetName"

b) Create a script Task just before the Excel Source Task.

c) Add the following code to the main method of the script task

string excelFile = null;
string connectionString = null;
OleDbConnection excelConnection = null;
DataTable tablesInFile = null;
int tableCount = 0;
DataRow tableInFile = null;
string currentTable = null;
int tableIndex = 0;
string[] excelTables = null;

excelFile = Dts.Variables["User::ExcelFile"].Value.ToString();

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelFile + ";Extended Properties=Excel 8.0";

excelConnection = new OleDbConnection(connectionString);

tablesInFile = excelConnection.GetSchema("Tables");

tableCount = tablesInFile.Rows.Count;
excelTables = new string[tableCount];

foreach (DataRow tableInFile_loopVariable in tablesInFile.Rows)
tableInFile = tableInFile_loopVariable;
currentTable = tableInFile["TABLE_NAME"].ToString();
excelTables[tableIndex] = currentTable;
tableIndex += 1;

Dts.Variables["User::SheetName"].Value = excelTables[0];

Dts.TaskResult = (int)ScriptResults.Success;

d) In your Excel source select the "Data access mode" as "Table name or view name variable".

e) Select the "User::SheetName" variable from the "Variable Name" dropdown list.

The connection "{XXX}" is not found. This error is thrown by Connections collection when the specific connection element is not found.


I had a few connections created in the Connection Managers in SSIS and all these connection configurations are stored in the Package Configurations. I just deleted a few unwanted connections from the Connection Managers and I got the following error with the package for every single deleted connection.

Error loading XXX.dtsx: The connection "{XXX}" is not found. This error is thrown by Connections collection when the specific connection element is not found.


Update your package configurations to reflect the changes made to the Connection Managers and the errors will be cleared automatically.