0

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

Palash Sachan
  • 61
  • 1
  • 12

1 Answers1

1

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/

Kamen
  • 3,575
  • 23
  • 35
  • thanks for the reply..can you please explain in detail what to do exactly in step 2..because i am getting the "Entity Data Model Wizard" and they haven't told anything about that – Palash Sachan Jul 15 '15 at 17:30
  • It depends on the VS setup and version. Try http://stackoverflow.com/questions/12933767/missing-ado-net-entity-data-model-template-from-visual-studio-2012-professional – Kamen Jul 15 '15 at 17:41
  • no help from that..is there any other way to do this..please help me buddy?? – Palash Sachan Jul 15 '15 at 17:55
  • 1
    Sorry, don't know another solution. Service, again, in Microsoft's code snippets: https://code.msdn.microsoft.com/windowsapps/How-to-access-data-from-5f2602ec – Kamen Jul 16 '15 at 10:01