コード例 #1
0
        public static bool ExistsAnd(string table, string field1, string field2, string value1, string value2)
        {
            string exists = "";
            string SQL    = "SELECT * FROM " + table + " WHERE " + field1 + "= '" + value1 + "' AND " + field2 + "= '" + value2 + "'";

            if (!Helper.Type.Contains("Lite"))
            {
                Reader = DBConnect.Reading(SQL);
                while (Reader.Read())
                {
                    exists = Reader.IsDBNull(0) ? "" : Reader.GetString(0);
                }
                Reader.Close();
                DBConnect.CloseConn();

                if (exists != "")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                try
                {
                    SQLconnect.ConnectionString = dbobject.datalocation();
                    SQLconnect.Open();
                }
                catch
                {
                }

                SQLiteCommand cmd = new SQLiteCommand();
                cmd             = SQLconnect.CreateCommand();
                cmd.CommandText = SQL;
                while (Reader.Read())
                {
                    exists = Reader.IsDBNull(0) ? "" : Reader.GetString(0);
                }
                Reader.Close();

                if (exists != "")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #2
0
        private void autocomplete()
        {
            AutoCompleteStringCollection AutoItem = new AutoCompleteStringCollection();

            foreach (Users r in Users.ListUsers())
            {
                AutoItem.Add(r.Contact);
            }
            contactTxt.AutoCompleteMode         = AutoCompleteMode.Suggest;
            contactTxt.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            contactTxt.AutoCompleteCustomSource = AutoItem;

            DBConnect.CloseConn();
        }