Bootstrapping SQL Express from WiX?

This is what I have, hope it helps: <?define ServerInstall=”SomeCondition” ?> <?define InstanceName = “YOUR_INSTANCE” ?> <?define SqlWebLink = http://download.microsoft.com/download/5/2/9/529FEF7B-2EFB-439E-A2D1-A1533227CD69/SQLEXPR_x86_ENU.exe ?> <Variable Name=”SqlVariable” Type=”string” Value=”/SAPWD=some_password” Hidden=”yes” /> <!– Read SQL Server keys to find current instance and version –> <util:RegistrySearch Id=”SqlInstanceKeyFound” Root=”HKLM” Key=”SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL” Value=”$(var.InstanceName)” Result=”exists” Variable=”SqlInstanceKeyFound” /> <util:RegistrySearch Id=”SqlInstanceKey” Root=”HKLM” Key=”SOFTWARE\Microsoft\Microsoft SQL … Read more

Error: Failed to generate a user instance of SQL Server

ok, it works now! guess it was a compound problem … the steps I took to resolve it are as such: Changed the following property in the connection string (note the subtle difference): AttachDbFilename=|DataDirectory|CustomerDb.mdf; Deleted the contents of the following directory: c:\Users\<user name>\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. I thought I had looked for this before, but … Read more

SQL/C# – Best method for executing a query

Use a SqlCommand. This code will only keep the connection alive for a very short period of time (as long as your query is performant): DataTable results = new DataTable(); using(SqlConnection conn = new SqlConnection(connString)) using(SqlCommand command = new SqlCommand(query, conn)) using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command)) dataAdapter.Fill(results);

SQL Server Express connection string for Entity Framework Code First

The problem with your connection string here is: <add name=”TrempimModel” connectionString=”data source=.\SQLEXPRESS;Integrated Security=SSPI; AttachDBFilename=|DataDirectory|aspnetdb.sdf; User Instance=true” providerName=”System.Data.SqlClient” /> You’re basically defining what “server” you’re connecting to – but you’re not saying what database inside the file to connect to. Also – the file extension for SQL Server Express database files is .mdf (not .sdf – … Read more