Example #1
0
    /// <summary>
    /// データを1件取得
    /// </summary>
    /// <param name="where"></param>
    /// <returns></returns>
    public static DataRow getOneData(string where)
    {
        DataTable dt = new DataTable();

        string query = "SELECT * FROM " + tablename + " WHERE " + where + ";";

        // データを取得
        dt = DBControll.select(query);

        if (dt == null)
        {
            return(null);
        }
        else
        {
            return(dt[0]);
        }
    }
Example #2
0
    /// <summary>
    /// 最新のIdを1件取得
    /// </summary>
    /// <param name="where"></param>
    /// <returns></returns>
    public static int getMaxId()
    {
        DataTable dt = new DataTable();

        string query = "SELECT max(id) AS id FROM " + tablename + ";";

        // データを取得
        dt = DBControll.select(query);

        if (dt == null)
        {
            return(0);
        }
        else
        {
            return((int)dt.Rows[0]["id"]);
        }
    }
Example #3
0
    /// <summary>
    /// データを複数件取得
    /// </summary>
    /// <param name="where"></param>
    /// <returns></returns>
    public static DataTable getData(string where = "")
    {
        DataTable dt    = new DataTable();
        string    query = "";

        if (where.Equals(""))
        {
            query = "SELECT * FROM " + tablename + ";";
        }
        else
        {
            query = "SELECT * FROM " + tablename + " WHERE " + where + ";";
        }

        // データを取得
        dt = DBControll.select(query);

        Debug.Log(query);

        return(dt);
    }