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>");
}
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>");
}
解决方案 »
- Form动态添加PictureBox,图片闪烁问题
- 怎样把Picturebox中的图像读出来
- 请教: 怎样在C# 调用 javascript写的事件
- 如何将这样的字符串按千分位显示?
- 如何设置datagridview控件的行高度
- 请问:CheckBox选中以后依然返回false的问题
- 下面是一段C++程序代码,请高手将它用C#转换一下,主要是指针部分的转化,谢谢
- 如何在一个类的函数中修改MAINFORM的一个LABEL的TEXT值?
- 干软件测试容易 还是干软件编程容易(c#)
- 各位接口和类到底有什么最根本的区别。
- 用WinForm(C#)编写一个应用程序,将一个扩展名为EXE文件移动到另一个文件夹下
- 找工作的烦恼(诉说贴)
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>alert('"+yazhu.toString()+"') </script>");