Archive for April, 2009

MultipleActiveResultSets (MARS), SQL server 2000 and LINQ

Using the MultipleActiveResultSets setting in a connection string allows one to have multiple datareaders open on the same connection, at the same time. This setting was introduced with SQL server 2005. Setting it with SQL server 2000 does not have any effect, or so I thought.

More »

How to: Change ‘sa’ password on SQL server 2008

If you happen to forget your SQL Server password for ‘sa’ account, then here’s a simple query to help you reset it: ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master] GO USE [master] GO ALTER LOGIN [sa] WITH PASSWORD=N’MyNewPassword’ MUST_CHANGE GO In Case you remember your Old Password and want to change the ‘sa’ password, use this query: [...]

More »

Using preg_replace_callback on class methods

To prevent an error like preg_replace_callback() [function.preg-replace-callback]: Requires argument 2, ‘function_name’, to be a valid callback, use the following snippet: $text = preg_replace_callback(     ‘((http(s?)\://){1}\S+)’,     array(get_class($this), ‘function_name’),     $text ); The trick is to call the method like so: array(get_class($this), ‘__shortUrl’)

More »

Could not load file or assembly ‘Name’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

On a 64-bit Windows installation this is caused by the fact that assemblies are compiled for x86 processors only. To change the compile settings do the following: Open the project properties Open the Compile tab Open the Advanced Compile Options… window Change the Target CPU from x86 to AnyCPU Recompile Happy programming!

More »