.NET 传递数据代码

来源:百度知道 编辑:UC知道 时间:2024/05/21 14:22:07
RT 有点麻烦 说个大概就可以了

<marquee direction="up" onmouseover="this.stop()" onmouseout="this.start()" style="width: 199px">

if (!IsPostBack)
{
ViewState["model"] = Request["model"];//新建视图
ViewState["id"] = Request["id"];
string sql = "Data Source=localhost;Initial Catalog=bookshop;User ID=sa;Password=123";
SqlConnection conn = new SqlConnection(sql);//建立连接
conn.Open();
if (ViewState["model"].ToString().Equals("edit"))
{
string sqlstr = "select * from newslist where id=" + Convert.ToInt32(ViewState["id"]);//查找为此id的用户信息
SqlCommand cmd = new SqlCommand(sqlstr, conn);
SqlDataReader dr = cmd.ExecuteReader();//读取数据库中的信息
if (dr.Read())
{<