public int insertPlayerInfoEntity(DBOperation dbOperation) { int retCode = 0; try { string sqlstr = "insert into player_info values('" + this.openid + "'," + this.score_self + "," + this.score + "," + this.selected_car_color + "," + this.shared + ",'" + this.start_time + "'," + this.status + ")"; dbOperation.executeSqlStr(sqlstr); } catch (Exception) { retCode = -1; } return(retCode); }
public int insertUserInfo(DBOperation dbOperation) { int retCode = 0; try { string sqlstr = "insert into user_info (openid,nickname,img_url) values ('" + this.Openid + "','" + this.Nickname + "','" + this.HeadImgUrl + "')"; dbOperation.executeSqlStr(sqlstr); } catch (Exception) { retCode = -1; } return(retCode); }
public bool executeSqlStr(string str) { try { SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConServerStr; conn.Open(); SqlCommand cmd = new SqlCommand(str, conn); cmd.ExecuteNonQuery(); cmd.Dispose(); DBOperation.destroySqlConn(conn); return(true); } catch (Exception) { return(false); } }
public bool CreateTable() { try { SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConServerStr; conn.Open(); string sqlstring = "CREATE TABLE malibutest (id INTEGER NOT Null primary key, value varchar(MAX))"; SqlCommand cmd = new SqlCommand(sqlstring, conn); cmd.ExecuteNonQuery(); cmd.Dispose(); DBOperation.destroySqlConn(conn); return(true); } catch (Exception) { return(false); } }