Search code examples
c#sqlwpfxamlwindows-store-apps

connecting to sql database in windows store app c# xaml


how to connect to sql database in Windows Store App in Visual Studio 2013??

i can connect and run query on the sql database in Windows Forms Application like this

SqlConnection conn = new SqlConnection("Data Source=JOHNDON;Initial Catalog=Register;Integrated Security=True");
        SqlCommand cmd = new SqlCommand("insert into Student values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')", conn);
        conn.Open();
        cmd.ExecuteNonQuery();
        MessageBox.Show("Submit Successfully");
            conn.Close();

Now i want to do the same in Windows Store App also please help..thanks


Solution

  • Check here - it is accomplished using WCF service:

    http://www.c-sharpcorner.com/UploadFile/7e39ca/connect-windows-store-apps-to-sql-server-database-using-wcf/