コード例 #1
0
        //----------------------------------------------

        //----------------------------------------------
        private bool IsSameDeptCode(iLocalDB db, string code)
        {
            db.Open();
            string query   = string.Format("SELECT xDept_name FROM xDEPARTMENT WHERE xDept_code='{0}'", code); // {0}에는 code 값이 들어감
            string err_msg = db.Query(query);
            string title   = "";

            if (err_msg != null)
            {
                MessageBox.Show(query + "\n\n" + err_msg, "SQL Error");
                return(false);
            }
            db.ExecuteReader(query);

            while (db.Read())
            {
                title = db.GetData("xDept_name").ToString();
            }
            if (title != cbx_학과입력.SelectedValue.ToString())  //입력 학과랑 학번이랑 틀림
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #2
0
        //----------------------------------------------

        //----------------------------------------------
        private int insertRow(iLocalDB db, string tableName, string dataStr)
        {
            db.Open();

            string queryStr = string.Format("INSERT INTO {0} VALUES({1})", tableName, dataStr);

            if (!DB_Query(db, queryStr))
            {
                return(0);
            }

            MessageBox.Show("정상적으로 데이터가 입력되었습니다.");

            psBox_비밀번호.Visibility = Visibility.Hidden;

            reloadInfo();
            All_text_clear();

            db.Close();
            return(1);  //OK
        }