How-to: Create an SQL server db, connect to it in Visual Studio, fill with data
using System.Data.SqlClient;
protected void ButtonReg_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString =
"Data Source=.\\SQLEXPRESS;" +
"Initial Catalog=GalleryDataBase;" +
"Integrated Security = true;";
conn.Open();
String query = "INSERT INTO dbo.UserData (Name,Email,Password) VALUES (@username, @email, @password)";
SqlCommand command = new SqlCommand(query, conn);
command.Parameters.AddWithValue("@username", TextBoxUserName.Text);
command.Parameters.AddWithValue("@email", TextBoxEmail.Text);
command.Parameters.AddWithValue("@password", TextBoxPassword.Text);
command.ExecuteNonQuery();
conn.Close();
}