Yearly Archives: 2010

42 posts

Christmas gift

Merry Christmas! My Christmas gift this year is a Slinky toy, the coolest toy in the whole wild world IMHO, even though it has nothing to do with computer or technology.

ORA-01745: invalid host/bind variable name, caused by reserved word in query

I wrote a simple parameterized query the other day against an Oracle database as follows: SELECT DISTINCT E.ID, E.Name, E.Department FROM Employee E WHERE E.ID = :uid Then in my application, I assign the value to the parameter as follows: cmd.Parameters.Add(new OracleParameter(":uid", OracleDbType.Varchar2)); However, when I was trying to run my application, I got an error saying: ORA-01745: invalid host/bind variable name Can you see what is causing the error? It took me hours of […]

How to use PreEmptive Dotfuscator in Visual Studio Setup project to protect your code

NOTE: After chatting with PreEmptive support, I was told that the Command Line Interface of Dotfuscator CE does not support Visual Studio 2013 or lower. It only supports, at the time of this note, Visual Studio 2015 and 2017. In this post, I will show you how to use PreEmptive Dotfuscator Community Edition in Visual Studio 2010 setup project to protect your source code. By default, PreEmptive Dotfuscator CE is integrated in Visual Studio 2010, […]

Using Microsoft SQL Server Management Objects to Deploy a Database with Visual Studio Setup Project

This tutorial demonstrates the use of Microsoft SQL Server Management Objects with a custom action in Visual Studio Setup project to deploy a database for your application. It is based on my development of Good Steward Express Edition application which can be downloaded at http://www.sardonyxtech.com/products.aspx References: MSDN article: Walkthrough: Using a Custom Action to Create a Database at Installation Handling “GO” Separators in SQL Scripts – the easy way Step 1. Create an installer class […]

VS 2010 designer error when loading typed dataset: To prevent possible data loss before loading the designer, the following errors must be resolved

Have you ever encountered this error when trying to open a typed dataset (.xsd) in Visual Studio 2010: To prevent possible data loss before loading the designer, the following errors must be resolved: Object reference not set to an instance of an object. The cause of this error is the .xsc file under the typed dataset is corrupted or damaged. If you expand the typed dataset in Solution Explorer, you will see the file: To […]

From eBook from Microsoft

Thinking about upgrading to Visual Studio 2010? Here is a free eBook from Microsoft Press that will help you make the decision: Moving to Microsoft Visual Studio 2010 (http://blogs.msdn.com/b/microsoft_press/archive/2010/09/13/free-ebook-moving-to-microsoft-visual-studio-2010.aspx)

Invalid length for a base-64 char array error

I have been working on a project that needs to encrypt and decrypt the query string of a page, and I get the “invalid length for a base-64 char array” error intermittently. Thanks to this post (the third reply by Kagisho), I got the error fixed. But what caused this error? And why does it not happen all the time? Here is my encryption function and decryption function: private string EncryptString(string inString) { RijndaelManaged sysAlg […]

Batch update your Web.config to workaround ASP.NET security vulnerability

[UPDATE]: There is no need for using this tool to update your web applications, because Microsoft has released the official ASP.NET security fix through Windows Update: http://weblogs.asp.net/scottgu/archive/2010/09/30/asp-net-security-fix-now-on-windows-update.aspx You may have already known the newly discovered ASP.NET security vulnerability, and the suggested workaround is to modify your Web.config file until Microsoft releases a security path, as mentioned in Scott’s blog: http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx. I hope you have already updated your application according to the workaround. However, what if […]

The request filtering module is configured to deny a request that exceeds the request content length

I have a file upload Web application running perfectly fine on IIS 6 server, but when I migrated it to an IIS 7 server, when I try to upload a large file, it throws an error saying: The request filtering module is configured to deny a request that exceeds the request content length. It puzzled me because I have this setting in my Web.config file: <httpRuntime maxRequestLength=”2097151″ executionTimeout=”7200″ /> This setting should allow me to […]

How to pass value to parameter in a parameterized query with IN clause

Take a look at the following MS SQL query: SELECT MT.MeetingTypeName, COUNT(DISTINCT(A.MemberId)) AS AttendanceTotal FROM MeetingAttendance AS MA INNER JOIN MeetingType AS MT ON MA.MeetingTypeId = MT.MeetingTypeId WHERE (MA.MeetingDate = @meetingDate) AND (MT.MeetingTypeId IN (1,2,3)) What if the IN clause in the above query needs to be dynamic? Can you use a parameter for the IN clause like this? SELECT MT.MeetingTypeName, COUNT(DISTINCT(A.MemberId)) AS AttendanceTotal FROM MeetingAttendance AS MA INNER JOIN MeetingType AS MT ON MA.MeetingTypeId […]