当前位置: 首页>>代码示例>>C#>>正文


C# DB.Connect方法代码示例

本文整理汇总了C#中DB.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# DB.Connect方法的具体用法?C# DB.Connect怎么用?C# DB.Connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


在下文中一共展示了DB.Connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetConfig

    public static string GetConfig(string param_name)
    {
        DB db = new DB();
        db.Connect ();

        string sqlQuery = "SELECT valor FROM configuraciones WHERE evento_id = "+Evento.GetActivoID()+" AND denominacion = '"+param_name+"'";
        db.dbcmd.CommandText = sqlQuery;
        db.reader = db.dbcmd.ExecuteReader();
        string value = "";
        while (db.reader.Read()) {
            if(!db.reader.IsDBNull(0)){
                value = db.reader.GetString(0);
            }
        }
        db.reader.Close();

        if (value == "") {
            sqlQuery = "SELECT valor FROM configuraciones WHERE evento_id = 0 AND denominacion = '"+param_name+"'";
            db.dbcmd.CommandText = sqlQuery;
            db.reader = db.dbcmd.ExecuteReader();
            while (db.reader.Read()) {
                value = db.reader.GetString(0);
            }
            db.reader.Close();
        }

        db.reader = null;
        db.Disconnect ();

        return value;
    }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:31,代码来源:Main.cs

示例2: CambiarActivo

 public static void CambiarActivo(string code)
 {
     DB db = new DB ();
     db.Connect ();
     string query = "UPDATE configuraciones SET valor = '" + code + "' WHERE denominacion = 'evento_code'";
     db.dbcmd.CommandText = query;
     if (db.dbcmd.ExecuteNonQuery () == 1) {
         GUItest.AlertMsg("agregado","Evento codigo '" + code + "' activado");
     }
     db.Disconnect ();
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:11,代码来源:Evento.cs

示例3: CambiarActivo

 public static void CambiarActivo(string id)
 {
     DB db = new DB ();
     db.Connect ();
     string query = "UPDATE configuraciones SET valor = '" + id + "' WHERE denominacion = 'promotora_id'";
     db.dbcmd.CommandText = query;
     if (db.dbcmd.ExecuteNonQuery () == 1) {
         Debug.Log ("Promotora id '" + id + "' activada");
     }
     db.Disconnect ();
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:11,代码来源:Promotora.cs

示例4: Registrar

 public static void Registrar()
 {
     DB db = new DB ();
     db.Connect ();
     string query = "INSERT INTO premios(fecha_entregado,evento_id,participante_id) VALUES ('"+System.DateTime.Now.ToString()+"',"+Evento.GetActivoID()+","+Main.participante_id+");";
     db.dbcmd.CommandText = query;
     if (db.dbcmd.ExecuteNonQuery () == 1) {
         int restantes = int.Parse(Main.GetConfig ("cantidad_premios"));
         Main.SaveConfig("cantidad_premios",(restantes-1).ToString());
     }
     db.Disconnect ();
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:12,代码来源:Premio.cs

示例5: SelectRespuesta

 public void SelectRespuesta(int id)
 {
     id_respuesta = id; DB db = new DB (); db.Connect ();
     string fields = "participante_id,pregunta_id,respuesta_id";
     string values = "" + Main.participante_id + "," + active_pregunta.GetComponent<Pregunta>().id + "," + id_respuesta;
     string sqlQuery = "INSERT INTO respuestas_participantes(" + fields + ") VALUES (" + values + ")";
     db.dbcmd.CommandText = sqlQuery;
     if(db.dbcmd.ExecuteNonQuery () == 1){
         StartCoroutine(hideRespuestas());
     }
     db.Disconnect ();
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:12,代码来源:Trivia.cs

示例6: GetActivoID

 public static int GetActivoID()
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT valor FROM configuraciones WHERE denominacion = 'promotora_id'";
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     int id = 0;
     while (db.reader.Read()) {
         id = int.Parse(db.reader.GetString(0));
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return id;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:16,代码来源:Promotora.cs

示例7: GetCountByEvento

 public static int GetCountByEvento(int evento_id)
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT COUNT(*) FROM premios WHERE evento_id = " + evento_id;
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     int count = 0;
     while (db.reader.Read()) {
         count = db.reader.GetInt32(0);
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return count;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:16,代码来源:Premio.cs

示例8: GetActivoCode

 public static string GetActivoCode()
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT valor FROM configuraciones WHERE denominacion = 'evento_code'";
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     string evento_code = "";
     while (db.reader.Read()) {
         evento_code = db.reader.GetString(0);
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return evento_code;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:16,代码来源:Evento.cs

示例9: GetGroupById

 public static Hashtable GetGroupById(int id)
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT * FROM grupospreguntas WHERE id = " + id;
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     Hashtable grupo = new Hashtable ();
     while (db.reader.Read()) {
         grupo.Add ("id",db.reader.GetInt32(0));
         grupo.Add ("denominacion",db.reader.GetString(1));
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return grupo;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:17,代码来源:Pregunta.cs

示例10: GetActivo

 public static Hashtable GetActivo()
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT id,nombre,apellido,username FROM usuarios WHERE id = "+GetActivoID();
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     Hashtable promotora = new Hashtable ();
     while (db.reader.Read()) {
         promotora.Add("id",db.reader.GetInt32(0));
         promotora.Add("nombre_apellido",db.reader.GetString(1)+" "+db.reader.GetString(2));
         promotora.Add("username",db.reader.GetString(3));
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return promotora;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:18,代码来源:Promotora.cs

示例11: GetActivo

 public static Hashtable GetActivo()
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT * FROM eventos WHERE code = '"+GetActivoCode()+"'";
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     Hashtable evento = new Hashtable ();
     while (db.reader.Read()) {
         evento.Add("id",db.reader.GetInt32(0));
         evento.Add("nombre",db.reader.GetString(1));
         evento.Add("code",db.reader.GetString(5));
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return evento;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:18,代码来源:Evento.cs

示例12: GetLastByEvento

 public static Hashtable GetLastByEvento(int evento_id)
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT * FROM premios WHERE evento_id = " + evento_id + " ORDER BY id DESC LIMIT 1";
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     Hashtable premio = new Hashtable();
     while (db.reader.Read()) {
         premio.Add ("id",db.reader.GetInt32(0));
         premio.Add ("fecha_entregado",db.reader.GetString(1));
         premio.Add ("evento_id",db.reader.GetInt32(2));
         premio.Add ("participante_id",db.reader.GetInt32(3));
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return premio;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:19,代码来源:Premio.cs

示例13: AfterRegister

    public static void AfterRegister()
    {
        DB db = new DB(); db.Connect ();

        string sqlQuery = "SELECT id FROM participantes ORDER BY id DESC LIMIT 1";
        db.dbcmd.CommandText = sqlQuery; db.reader = db.dbcmd.ExecuteReader();
        while (db.reader.Read()) {
            if(!db.reader.IsDBNull(0)){
                participante_id = db.reader.GetInt32(0);
            }
        }
        db.reader.Close(); db.reader = null; db.Disconnect ();

        if (Convert.ToBoolean (Main.GetConfig ("juego_activo"))) {
            StartGame ();
        } else {
            Home ();
        }
    }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:19,代码来源:Main.cs

示例14: GetSyncStats

    void GetSyncStats()
    {
        DB db = new DB();
        db.Connect ();

        string sqlQuery = "SELECT * FROM 'sync' ORDER BY id DESC LIMIT 1";
        db.dbcmd.CommandText = sqlQuery;
        db.reader = db.dbcmd.ExecuteReader();
        while (db.reader.Read()) {
            transform.Find ("LastSync").Find ("Value").gameObject.GetComponent<Text>().text = db.reader.GetString(1);
            transform.Find ("SyncedUsers").Find ("Value").gameObject.GetComponent<Text>().text = db.reader.GetInt32(2).ToString();
            transform.Find ("SyncedEvents").Find ("Value").gameObject.GetComponent<Text>().text = db.reader.GetInt32(3).ToString();
        }
        db.reader.Close();

        sqlQuery = "SELECT COUNT(*) FROM participantes WHERE external_id IS NULL";
        db.dbcmd.CommandText = sqlQuery;
        db.reader = db.dbcmd.ExecuteReader();
        while (db.reader.Read()) {
            if(!db.reader.IsDBNull(0)){
                transform.Find ("UnsyncedUsers").Find ("Value").gameObject.GetComponent<Text>().text = db.reader.GetInt32(0).ToString();
            }else{
                transform.Find ("UnsyncedUsers").Find ("Value").gameObject.GetComponent<Text>().text = "0";
            }
        }
        db.reader.Close();

        sqlQuery = "SELECT COUNT(*) FROM eventos WHERE external_id IS NULL";
        db.dbcmd.CommandText = sqlQuery;
        db.reader = db.dbcmd.ExecuteReader();
        while (db.reader.Read()) {
            if(!db.reader.IsDBNull(0)){
                transform.Find ("UnsyncedEvents").Find ("Value").gameObject.GetComponent<Text>().text = db.reader.GetInt32(0).ToString();
            }else{
                transform.Find ("UnsyncedEvents").Find ("Value").gameObject.GetComponent<Text>().text = "0";
            }
        }
        db.reader.Close();

        db.reader = null;
        db.Disconnect ();
    }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:42,代码来源:Sync.cs

示例15: GetAllGroups

 // Funciones Grupos
 public static Hashtable GetAllGroups()
 {
     DB db = new DB();
     db.Connect ();
     string sqlQuery = "SELECT * FROM grupospreguntas";
     db.dbcmd.CommandText = sqlQuery;
     db.reader = db.dbcmd.ExecuteReader();
     Hashtable grupos = new Hashtable ();
     int index = 0;
     while (db.reader.Read()) {
         Hashtable grupo = new Hashtable ();
         grupo.Add ("id",db.reader.GetInt32(0));
         grupo.Add ("denominacion",db.reader.GetString(1));
         grupos.Add (index, grupo);
         index ++;
     }
     db.reader.Close();
     db.reader = null;
     db.Disconnect ();
     return grupos;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:22,代码来源:Pregunta.cs


注:本文中的DB.Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。