I am experimentation in hooking up a C# application for an MDF database the very first time, and that i need some help ..

I designed a small MDF database file in Visual Studio 2010, then produced another project and imported the file in to the project itself.

I'm not attempting to connect with the MDF file via code. Here the code I am using:

namespace DBtestApp1
    public partial class Form1 : Form
        public Form1()
        System.Data.SqlClient.SqlConnection con;
        private void Form1_Load(object sender, EventArgs e)
            con = new System.Data.SqlClient.SqlConnection();
            con.ConnectionString = "DataSource=.\\SQLEXPRESS; AttachDbFilename =SampleDatabase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
            MessageBox.Show("Connection opened");
            MessageBox.Show("Connection closed");

After I run the applying, I recieve the best in the line where I define the bond string, and also the exception has this message towards the top of the stack:

System.ArgumentException: Keyword not supported: 'datasource'.

Can someone point me within the right direction ?

Add space between Data Source

 con.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=c:\folder\SampleDatabase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
Server=.\SQLExpress;AttachDbFilename=c:\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;