예제 #1
0
        public bool API_SetObjImgUrlByServerId(int iServerId, string strObjImgUrl)
        {
            bool bResult = false;

            int imgWidth  = 0;
            int imgHeight = 0;

            bool bGetSizeResult = API_GetImgSizeByUrl(strObjImgUrl, ref imgWidth, ref imgHeight);

            if (bGetSizeResult == true)
            {
                string strConn = YimaDataBase.GetSqlConnectionString();
                strObjImgUrl = strObjImgUrl.Replace("'", "‘");
                string strSql = "update ObjTable set strObjImgUrl='" + strObjImgUrl + "',iObjImgWidth=" + imgWidth.ToString() + ",iObjImgHeight=" + imgHeight.ToString() + " where id = " + iServerId.ToString();
                int    ii     = YimaDataBase.ExecuteSql(strSql, strConn);

                if (ii > 0)
                {
                    bResult = true;
                }

                /*
                 * string strSql = "update ObjTable set strObjImgUrl=@objImgUrl,iObjImgWidth=@iObjImgWidth,iObjImgHeight=@iObjImgHeight where id = @id";
                 * using (OleDbConnection conn = new OleDbConnection(strConn))
                 * {
                 *  using (OleDbCommand cmd = new OleDbCommand(strSql, conn))
                 *  {
                 *      cmd.Parameters.Add("id", OleDbType.Integer);
                 *      cmd.Parameters["id"].Value = iServerId;
                 *
                 *      cmd.Parameters.Add("objImgUrl", OleDbType.VarChar, 50);
                 *      cmd.Parameters["objImgUrl"].Value = strObjImgUrl;
                 *
                 *      cmd.Parameters.Add("iObjImgWidth", OleDbType.Integer);
                 *      cmd.Parameters["iObjImgWidth"].Value = imgWidth;
                 *
                 *      cmd.Parameters.Add("iObjImgHeight", OleDbType.Integer);
                 *      cmd.Parameters["iObjImgHeight"].Value = imgHeight;
                 *
                 *      try
                 *      {
                 *          conn.Open();
                 *          int i = cmd.ExecuteNonQuery();
                 *
                 *          if (i > 0)
                 *          {
                 *              bResult = true;
                 *          }
                 *      }
                 *      catch (Exception ex)
                 *      {
                 *          string message = ex.ToString();
                 *      }
                 *  }
                 * }
                 * */
            }
            return(bResult);
        }
예제 #2
0
        public bool API_SetObjectGeoByServerId(int iServerId, string strObjGeo)
        {
            bool bResult = false;
            //string strSql = "update ObjTable set strObjGeo=@objGeo where id = @id";
            string strConn = YimaDataBase.GetSqlConnectionString();

            strObjGeo = strObjGeo.Replace("'", "‘");

            string strSql = "update ObjTable set strObjGeo='" + strObjGeo + "' where id = " + iServerId.ToString();
            int    ii     = YimaDataBase.ExecuteSql(strSql, strConn);

            if (ii > 0)
            {
                bResult = true;
            }
            return(ii > 0);

            /*
             * using (OleDbConnection conn = new OleDbConnection(strConn))
             * {
             *  using (OleDbCommand cmd = new OleDbCommand(strSql, conn))
             *  {
             *      cmd.Parameters.Add("id", OleDbType.Integer);
             *      cmd.Parameters["id"].Value = iServerId;
             *
             *      cmd.Parameters.Add("objGeo", OleDbType.VarChar, 2000);
             *      cmd.Parameters["objGeo"].Value = strObjGeo;
             *
             *      try
             *      {
             *          conn.Open();
             *          int i = cmd.ExecuteNonQuery();
             *
             *          if (i > 0)
             *          {
             *              bResult = true;
             *          }
             *      }
             *      catch (Exception ex)
             *      {
             *          string message = ex.ToString();
             *      }
             *  }
             * }
             *
             * return bResult;
             */
        }
예제 #3
0
        public bool API_SetObjectContentByServerId(int iServerId, string strObjectContent)
        {
            strObjectContent = strObjectContent.Replace("'", "’");
            string strConn = YimaDataBase.GetSqlConnectionString();

            string strSql = "update ObjTable set strObjContent='" + strObjectContent + "' where id = " + iServerId.ToString();
            int    ii     = YimaDataBase.ExecuteSql(strSql, strConn);

            return(ii > 0);

            /*
             * string strSql = "update ObjTable set strObjContent=@strObjContent where id = @id";
             * using (OleDbConnection conn = new OleDbConnection(strConn))
             * {
             *  using (OleDbCommand cmd = new OleDbCommand(strSql, conn))
             *  {
             *      cmd.Parameters.Add("id", OleDbType.Integer);
             *      cmd.Parameters["id"].Value = iServerId;
             *
             *      cmd.Parameters.Add("strObjContent", OleDbType.VarChar, 100);
             *      cmd.Parameters["strObjContent"].Value = strObjectContent;
             *
             *      try
             *      {
             *          conn.Open();
             *          int i = cmd.ExecuteNonQuery();
             *
             *          if (i > 0)
             *          {
             *              bResult = true;
             *          }
             *      }
             *      catch (Exception ex)
             *      {
             *          string message = ex.ToString();
             *      }
             *  }
             * }
             * return bResult;
             */
        }