Blog posts about database

  • Unknown server tag 'asp:LinqDataSource'

    June 18, 2012 | Tags: ASP.NET, Database, C#, Troubleshooting, LINQ
    If you're getting an error saying that the asp:LinqDataSource is unknown, you most likely is missing the declaration in your web.config file. To fix this:

    1. Open your web.config file and locate the <controls> block.
    2. Add the following element: <add assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.UI.WebControls" tagprefix="asp"> into the <controls&gt; block.
    3. Reload the page and see it working :)

  • Sync user and login for SQL database

    February 01, 2011 | Tags: Frax, Database, Troubleshooting, SQL, Snippet
    Got a login on your SQL server and the same user in a database but they are not connected? Even though the names are the sames the unique IDs are not. Here's a snippet from my college Fredrik that's very useful connecting the user name between server login and database user. Replace 'user' with 'your user name':
    EXEC sp_change_users_login 'Auto_Fix', 'user'

    And a small celebration! This is the 100th post :)

  • The best links for learning LINQ

    September 17, 2010 | Tags: Database, C#, LINQ
    The NOT IN clause in LINQ to SQL
    MSDN: Visual Basic LINQ to SQL Samples
    MSDN: 101 LINQ Samples for C#

  • Exporting SQL Server data to script

    January 29, 2010 | Tags: Database, SQL
    There are some situation where data in one SQL server database need to be exported as a script in order to publish it to another server.

    There are plenty of scripts and tools around the web, for instance Red Gate's SQL Data Compare tool is pretty nice. But if you're on a tight budget, this one might be out of reach. So what to do?

    If you're running SQL Server 2008 you already have this feature. You can use the generate script wizard in order to get the data as INSERT-statements.

    If you're running SQL Server 2000/2005 you need to download Microsoft SQL Server Database Publishing Wizard. It's a stand alone tool that lets you script the database structure and/or the data contained in your database.

    Note on the database publishing wizard for 2000/2005: You might get a 'file already in use' when you export. If so, just delete the file, back one step and have another go. It usually works.