各位高手,请帮我看一下 这段程序有什么问题啊?
老说找不到架构信息,还抱错! 先谢谢了
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 luntan_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string cnstr = "Data Source=LIUHR2006\LIUHR;Initial Catalog=liu_excel;Integrated Security=True";
SqlConnection con = new SqlConnection(cnstr);
SqlCommand cmd=new SqlCommand();
cmd.Connection=con;
cmd.CommandText="insert into liu1(a,b,c) values(@a,@b,@c)";
cmd.Parameters.Add("@a",SqlDbType.Int,0);
cmd.Parameters.Add("@b",SqlDbType.VarChar,50);
cmd.Parameters.Add("@c",SqlDbType.Char,10);
cmd.Parameters("@a").Value = TextBox1.Text;
cmd.Parameters("@b").Value = TextBox2.Text;
cmd.Parameters("@c").Value = TextBox2.Text;
try
{
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
catch{}
}
}