Conencting sdf to vs2008 RRS feed

  • Question

  • I have created 3 .sdf file from Sql Server 2008 express but I am unabe to connect it to my vs2008 on another PC. Am I right to say that SDF File shld be able to transfer to other PC without any problem?

    Where as for the PC that I created with, I have no problem in accessing the sdf file either from Sql Server 2008 or VS2008. Any opinions on this?

    Tuesday, July 7, 2009 10:21 AM


All replies

  • SDF files are SQL Server Compact Edtition files, not SQL Server Express. SQL Server Express files have MDF file extension
    Val Mazur (MVP)
    Tuesday, July 7, 2009 10:31 AM
  • Are you encountering an error? If so could you indicate what it is?

    With respect to deployment see the following:

    How to: Deploy a SQL Server Compact Edition Database with an Application 

    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, July 7, 2009 12:33 PM
  • but I am able to create sdf file through the query at sql server 08. and able to attach it to sql server 08.
    Tuesday, July 7, 2009 1:36 PM
  • It just state that the file is corrupted and they asked me to use some sort of repair tool to repair the file. I don't have the error message now as its in the office
    Tuesday, July 7, 2009 1:37 PM
  • I don't understand why you would want to attach an .SDF file to SQL Server. A SQL Server CE file (.SDF) is accessible w/o SQL Server.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, July 7, 2009 4:02 PM
  • No.. i didnt want to attach it to SQL Server now.. I am attaching it to Vs2008 now but thats the error they gave me. If I can attach to SQL server, Why cant i attach it to Vs2008?
    Tuesday, July 7, 2009 4:12 PM
  • How are you trying to connect? Are you using Tools...Connect to Database? Are you using code?
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, July 7, 2009 4:33 PM
  • Ok.. let me explain again. Probably I had phase it wrongly.

    I had created the 3 sdf file through sql server 2008 by using query from a DDL file. After which, I am able to attach it to the server explorer in VS2008. However when I transfer the sdf to another computer, and tried to connect it using the server explorer in VS2008, It gives me an error saying that my sdf file is corrupted and had to repair.

    Due to this, I tried to attach my sdf file using SQL Server 2008 (on that computer which its VS2008 gives an error), it successfully attached.

    This is how I created my sdf file from Sql Server 2008.

    create database "dbURM"
      ( NAME = dbALURM, FILENAME = 'C:\URM\Database\dbURM.sdf', SIZE = 3 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 256 KB ) 

    Wednesday, July 8, 2009 1:59 AM
  • Let's go back and start from scratch. Is it your goal to use SDF file from SQL Server CE instead of MDF from SQL Server?
    Val Mazur (MVP)
    Thursday, July 9, 2009 10:25 AM
  • Are you certain that the Create Database DDL command is actually creating SQL CE database?

    I would try using SQL Server Management Studio Express or maybe even use code with the SQLCeEngine class.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, July 9, 2009 2:46 PM