请高手看看代码哪里错了,请指正
..........................................................................
App_Code/db.cs类中的代码如下:
public static void Insert(string Ntitle, string Ncontent)
{
SqlConnection con = new SqlConnection(ConnString());
SqlCommand cmd = new SqlCommand();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand( "NewInsertCommand ", con);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
SqlParameter para = new SqlParameter( "@Ntitle ",Ntitle);
SqlParameter para1 = new SqlParameter( "@Ncontent ",Ncontent);
sda.SelectCommand.Parameters.Add(para);
sda.SelectCommand.Parameters.Add(para1);
cmd.Connection = con;
try
{
con.Open();
cmd.ExecuteNonQuery();
}
catch (Exception e)
{
}
finally
{
con.Close();
sda.Dispose();
cmd.Dispose();
}
}
..........................................................................
按钮页代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
db.Insert(this.TextBox1.Text,this.TextBox2.Text);
}
..........................................................................
存储过程代码:
ALTER PROCEDURE dbo.NewInsertCommand
@Ntitle varchar(50),
@Ncontent ntext
AS
SET NOCOUNT OFF
insert into [zNotice] ([Ntitle],[Ncontent]) values(@Ntitle,@Ncontent);
......................................