Exemplo n.º 1
0
        /// <summary>
        /// 判断建筑是否存在
        /// </summary>
        /// <param name="objectid">Object主键</param>
        /// <returns></returns>
        public bool JudgeObjectID(string objectid)
        {
            oledbConn = SqlConn.getOleConn();
            string sql = "select * from builderObject where buildObjectID = '" + objectid + "'";

            oledbCom = new OleDbCommand(sql, oledbConn);
            if (oledbCom.ExecuteScalar() == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 查询全部信息
 /// </summary>
 /// <param name="tablename">表名</param>
 /// <param name="conditions">条件</param>
 /// <returns></returns>
 public DataSet selectTableAll(string tablename)
 {
     using (oledbConn = SqlConn.getOleConn())
     {
         try
         {
             oledbCom = new OleDbCommand("select * from " + tablename + " ", oledbConn);
             oledbDap = new OleDbDataAdapter(oledbCom);
             ds       = new DataSet();
             oledbDap.Fill(ds, tablename);
         }
         catch (Exception e)
         {
             System.Windows.Forms.MessageBox.Show(e.Message.ToString());
         }
         return(ds);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 插入方法
 /// </summary>
 /// <param name="commStr">一个完整的insert语句sql的</param>
 /// <returns></returns>
 public bool Insert(string commStr)
 {
     using (oledbConn = SqlConn.getOleConn())
     {
         try
         {
             oledbCom = new OleDbCommand(commStr, oledbConn);
             if (oledbCom.ExecuteNonQuery() > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception e)
         {
             System.Windows.Forms.MessageBox.Show(e.Message.ToString());
             return(false);
         }
     }
 }