Ame*_*awi -1 c# sql sql-server asp.net
问题是我的代码没有使用asp.net c#将新记录插入/保存到我的SQL Server数据库中,并且没有给我任何错误.
这是我的代码:
public partial class AddNews_AddNews : System.Web.UI.Page
{
protected SqlConnection _connection;
protected SqlCommand _command;
protected SqlDataAdapter _adp;
protected System.Data.DataTable _tbl;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
prepareConnection();
_command.CommandText = "INSERT INTO" + drbdlSection.SelectedItem + "(Title,Contect) VALUES (" + titleTextBox.Text + "," + CKEditor1.Text + ");";
}
protected void prepareConnection()
{
_connection = new SqlConnection(@"Data Source=localhost;Initial Catalog=BrainStorms;User ID=sa;Password=xxx");
_connection.Open();
_command = new SqlCommand();
_command.Connection = _connection;
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1904 次 |
最近记录: |