Ejemplo n.º 1
0
        public bool Savemassage(int sort, string massage, string massgetitle)
        {
            bool ex;//判断数据库操作是否成功
            string sql;//数据库操作语句
            string str;//数据库连接参数
            str = "Server=YourSQLServer;user id=sa;password=;initial catalog=Northwind;Connect Timeout=30";
            DataBaseAccess st = new DataBaseAccess(str);
            sql = "insert into 表名() values(massage,sort,massagetitle)";
            ex = st.ExecuteDataBase(sql);
            return ex;


            //将信息保存入数据库
        }
Ejemplo n.º 2
0
   //-----------------------------------------------------
 override  public bool   Record()
   {
       try
       {
           String sqlstr = "";
           sqlstr = "insert into Visitors Values( '" + IP_ + "','" + Time_ + "')";
           DataBaseAccess DAO = new DataBaseAccess();
           DAO.ExecuteDataBase(sqlstr);
       }
       catch (Exception e)
       {
           return false;
       }
       return true;
   }