result2 = new Class1().hsgexucute(sql);
if (result2 == 1)
{
Response.Write("<script>javascript:alert('操作成功');</script>");
}
else
{
Response.Write("<script>javascript:alert('系统错误,您输入了非法字符!');</script>");
}
采购查询的主要代码如下所示:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string sql;
sql = "select * from kucun order by id desc";
getdata(sql);
}
}
private void getdata(string sql)
{
DataSet result = new DataSet();
result = new Class1().hsggetdata(sql);
if (result != null)
{
if (result.Tables[0].Rows.Count > 0)
{
int k = 0;
for (k = 0; k < result.Tables[0].Rows.Count; k++)
{
promc.Items.Add(result.Tables[0].Rows[k]["promc"].ToString().Trim());
}
}
}
}
protected void Button1_Click(object sender, EventArgs e) {
string sql;
sql = "insert into tuihuo(promc,price,rkprice,gys,thsl,memo) values('"+promc.SelectedItem.ToString().Trim()+"',"+price.Text.ToString().Trim()+","+rkprice.Text.ToString().Trim()+",'"+gys.Text.ToString().Trim()+"',"+thsl.Text.ToString().Trim()+",'"+memo.Text.ToString().Trim()+"')";
int result;
result = new Class1().hsgexucute(sql);
if (result == 1)
{
Response.Write("<script>javascript:alert('添加成功');</script>");
}
else
{
Response.Write("<script>javascript:alert('系统错误,您没有设置好数据库的连接!');</script>");