using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
 
public partial class dbTest_Insert : System.Web.UI.Page
{
SqlConnection connection;
protected void Page_Load(object sender, EventArgs e)
{
connection = new SqlConnection(ConfigurationManager.ConnectionStrings["GamesConnection"].ConnectionString);
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlCommand command = new SqlCommand("INSERT INTO gameTable(gameName, gamePlatform) VALUES (@id_gameName, @id_gamePlatform)", connection);
 
SqlParameter nameContent = new SqlParameter("@id_gameName", SqlDbType.VarChar);
nameContent.Value = txtGameName.Text;
command.Parameters.Add(nameContent);
 
SqlParameter platformContent = new SqlParameter("@id_gamePlatform", SqlDbType.VarChar);
platformContent.Value = txtGamePlatform.Text;
command.Parameters.Add(platformContent);
 
connection.Open();
command.BeginExecuteNonQuery();
connection.Close();
 
Response.Redirect("Results.aspx");
}
}