Friday, April 22, 2011

Passing SQL String as Query String in Web Applications

I was working on a web page where I had to pass a SQL Query string to another page as query parameter.

When I finished the coding and tested, it was working for some queries and failing for certain. After a close examination I found out it was failing for "LIKE" queries. The query had characters like '%'

For example if the query is like "SELECT FNAME LIKE '%ANA%'" then this will fail. Because the receiving page was unable to pass the query string properly.

After some research I found out there is a javascript function encodeURI() which will encode the query string.

There is also another function decodeURI() which does opposite of encodeURI().

By using these functions I was able to complete the coding.



Visual Studio 2010 Compilation Error

While working with Visual Studio 2010 in Silverlight coding I got this error message.

"Unable to attach to application. The version of clr.dll in the target does not match the one mscordacwks.dll was built for.Do you want to continue anyway ?"

I tried cleaning up the solution and rebuilding still did not fix anything.

Finally after some research I found out that this error happens when the Windows Updates is on progress.

I waited till Windows updates are complete and then restarted the laptop.

Then recompiled and it worked.

Hope this helps.

Here is the snapshot of the error image.

All Blogs so far ...