怎样Response.Write输出script 显示变量值?小问题
string yazhu,Zongshu, SqlStrings;
SqlConnection con = new SqlConnection("server=127.0.0.1;database=Toupiao;uid=sa;pwd=sa");
con.Open();
SqlDataAdapter sd = new SqlDataAdapter("select * from Usermain where Username='" + username + "' ", con);
DataSet ds = new DataSet();
sd.Fill(ds);
Zongshu = ds.Tables[0].Rows[0]["Gold"].ToString();
yazhu = TextBox1.Text.ToString();
if (int.Parse(Zongshu) < int.Parse(yazhu))
{
Response.Write("<script>alert('Gold不够')</script>");
}
else
{
int Zuihou = int.Parse(Zongshu) - int.Parse(yazhu);
SqlStrings = "update Usermain set Gold = '" + Zuihou + "' where Username = '" + username + "'";
SqlCommand cmd = new SqlCommand(SqlStrings, con);
cmd.ExecuteNonQuery();
Response.Write("<script>alert('我要在这调用"yazhu"这个变量的值应该怎样写?')</script>");
}