public ActionResult Register(String username, String password, String realname, String email, String phone, String gender, String wx) { DboUtils db = new DboUtils(); String sql0 = "select * from user_info where username='******'"; DataSet ds = db.query(sql0); String errorMessage = ""; if (ds.Tables[0].Rows.Count > 0) { errorMessage = "用户名已经被注册!!!"; return(Redirect("/Register/Index?" + errorMessage)); } else { String sql = "INSERT INTO user_info(realname, username, pwd, email, sex, wx, phonenum) VALUES('" + realname + "','" + username + "','" + password + "','" + email + "','" + gender + "','" + wx + "','" + phone + "')"; DboUtils db1 = new DboUtils(); int i = db1.insert(sql); if (i > 0) { return(Redirect("/Login/Index")); } else { errorMessage = "用户名已经被注册!!!"; return(Redirect("/Register/Index?" + errorMessage)); } } }
// GET: Insert public ActionResult Index() { DboUtils db = new DboUtils(); int[] array = new int[10]; for (int i = 1; i < 10; i++) { String sql = "INSERT INTO top_info(title, up_item, position, info, img_s, img_b, video) values('俏江南公告-" + i + "','C81B33D6-BA93-4761-B740-988D20589643','" + i + "','','/image/notice" + i + ".jpg' , '' , '')"; //String sql = "insert into user_info(username,pwd)values('1','')"; array[i - 1] = db.insert(sql); } ViewBag.array = array; return(View()); }
public ActionResult createOrder(String roomId, String ordering, String orderingId, String orderingState, String node, String total) { String sql = "INSERT INTO orderList(roomId,ordering,orderingId,orderingState,note,total) VALUES('" + roomId + "','" + ordering + "','" + orderingId + "','" + orderingState + "','" + node + "','" + total + "') "; int raw = 0; raw = dbo.insert(sql); if (raw > 0) { return(Json("true")); } else { return(Json("false")); } }
public String ConfirmAddNav(int id, String name, String href) { DboUtils db = new DboUtils(); String sql = "INSERT INTO nav(id,name,href) VALUES('" + id + "','" + name + "','" + href + "')"; int x = db.insert(sql); string message = "操作失败"; if (x > 0) { message = "操作成功"; return(message); } else { return(message); } }
public String ConfirmAddGood(String name, int upitem, double price, String img, String info) { Console.WriteLine(name + "---" + upitem + "---" + price + "---" + img + "---" + info); DboUtils db = new DboUtils(); String sql = "INSERT INTO good(name,price,img,info,upitem) VALUES('" + name + "','" + price + "','" + img + "','" + info + "','" + upitem + "')"; int x = db.insert(sql); string message = "操作失败"; if (x > 0) { message = "操作成功"; return(message); } else { return(message); } }