车辆租赁网站开发
SqlTransaction stran = conn.BeginTransaction(); SqlCommand cmdTemp = new SqlCommand();cmdTemp.Transaction = stran;cmdTemp.Connection = conn; try {cmdTemp.CommandText = "update 网站车辆信息 set 是否租出='是' where 车辆名称='" + this.DropDownList2.Text.Trim() + "'";cmdTemp.ExecuteNonQuery(); decimal sheng = kaJine - price; cmdTemp.CommandText = "update 公司银行 set 卡内金额='" + sheng.ToString() + "' where 会员账号='" + this.TextBox1.Text.Trim() + "'"; cmdTemp.ExecuteNonQuery(); cmdTemp.CommandText = & quot;insert into 订单信息表(会员账号,会员密码,车辆名称,取车方式,取车时间,租赁天数) values('" + this.TextBox1.Text.Trim() + "','" + this.TextBox2.Text.Trim() + "','" + this.DropDownList2.Text.Trim() + "','" + this.DropDownList3.Text.Trim() + "','" + this.Calendar1.SelectedDate + "','" + this.TextBox3.Text.Trim() + "')"; cmdTemp.ExecuteNonQuery(); stran.Commit(); Response.Write("[removed]alert('订车成功')[removed]");} catch{stran.Rollback();Response.Write("[removed]alert('订车失败')[removed]"); } quot;insert into 订单信息表(会员账号,会员密码,车辆名称,取车方式,取车时间,租赁天数) values('" + this.TextBox1.Text.Trim() + "','" + this.TextBox2.Text.Trim() + "','" + this.DropDownList2.Text.Trim() + "','" + this.DropDownList3.Text.Trim() + "','" + this.Calendar1.SelectedDate + "','" + this.TextBox3.Text.Trim() + "')"; cmdTemp.ExecuteNonQuery(); stran.Commit(); Response.Write("[removed]alert('订车成功')[removed]");} catch{stran.Rollback();Response.Write("[removed]alert('订车失败')[removed]"); }
暂无评论