<asp:HyperLinkField DataNavigateUrlFields="score_id" DataNavigateUrlFormatString="PerfEvaluationEntry.aspx?Score_ID={0}"
DataTextField="contractNo" SortExpression="contractNo" HeaderText="{{合同号}}" />score_id是你要传值得字段名
DataTextField="contractNo" SortExpression="contractNo" HeaderText="{{合同号}}" />score_id是你要传值得字段名
修改更新就是update啊
2.用session传递
可是我用update更新不了啊
我从数据库中显示3个字段分别显示在3个textbox中,然后我想在textbox中修改这些数据更新到数据库中,我的代码:
try
{
string strDB = "Server=(local);database=users;Integrated Security=SSPI;";
SqlConnection cn = new SqlConnection(strDB);
cn.Open();
string strURL = "update news set title = '"+TextBox1.Text+"',content = '"+TextBox3.Text+"' where data = '"+TextBox2.Text+"'";
SqlCommand cmd = new SqlCommand(strURL, cn);
cmd.ExecuteNonQuery();
cn.Close();
}
catch (Exception e1)
{
Label1.Text = e1.Message;
}
可我更新不了数据库啊~是不是代码写的有问题
string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("database/1.mdb"); OleDbConnection myConn = new OleDbConnection(ConnStr);
myConn.Open();
String sqlcmd = "Update table set where id = " + id;
OleDbCommand Cmd = new OleDbCommand(sqlcmd, myConn); Cmd.ExecuteNonQuery();
myConn.Close();
只要能得到传的ID值,就没有问题.我用的是access库