所以我有以下代码,但数据库没有更新,页面似乎没有显示任何错误。构建中没有错误,但仍然没有数据进入。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class ValidateMe : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection("Data Source=MICROSOF-58B8A5\SQL_SERVER_R2;Initial Catalog=Movie;Integrated Security=True");
connection.Open();
if (TextBox8.Text == TextBox9.Text)
{
string UserName = TextBox7.Text;
string Password = TextBox8.Text;
string FirstName = TextBox1.Text;
string LastName = TextBox2.Text;
string Address = TextBox3.Text;
string PostCode = TextBox4.Text;
string Phone = TextBox5.Text;
string Email = TextBox6.Text;
string sqlquery = "INSERT INTO `users` (`user_id`, `username`, `first_name`, `last_name`, `password`, `address`, `postcode`, `phone`, `email`, `level`) VALUES (NULL, '@UserName', '@FirstName', '@LastName', '@Password', '@Address', '@PostCode', '@Phone', '@Email');";
SqlCommand command = new SqlCommand(sqlquery, connection);
}
}
}
对我所缺少的任何帮助将不胜感激。