2019年6月24日 星期一

(SQL)抽獎系統

https://www.fooish.com/sql/select-into.html

隨機抽取
select top 5 * from  [dbo].[Temp2] order by newid()


SELECT table_column1, table_column2, table_column3...
INTO new_table_name [IN another_database]
FROM table_name;
其中 new_table_name 為欲新建的資料表名稱,該資料表會自動建立,且不可與已經存在的資料表名稱相同;而 another_database 為至外部資料庫的路徑。

ps:
結合運用sql join 語法
https://dotblogs.com.tw/caubekimo/2010/07/28/16874

2019年6月14日 星期五

C# Winform開啟網址url

 #region Winform開啟網址url
        private void BtnLogo_Click(object sender, EventArgs e)
        {
            OpenUrl("https://www.apmtech.com.tw/");
        }
        /// <summary>
          /// C# Winform開啟網址url
          /// </summary>
          /// <param name="url">要開啟的網頁網址</param>
        public void OpenUrl(string url)
        {
            try
            {
                Process pro = new Process();
                //pro.StartInfo.FileName = "iexplore.exe";
                //pro.StartInfo.FileName = "MicrosoftEdge.exe";
                pro.StartInfo.FileName = "chrome.exe";
                pro.StartInfo.Arguments = url;
                pro.Start();
            }
            catch (Exception)
            {

                this.rtfMsg.Text = "Hi:請確認chrome.exe正常" + "   @" + DateTime.Now.ToString();
            }

        }
        #endregion

視窗縮小到工具列


C#.Net 視窗縮小到工具列

        #region 使用NotifyIcon視窗縮小到工具列
        private void BtnFormMini_Click_1(object sender, EventArgs e)
        {
            this.BtnFormMini.Click += Form1_Resize;
        }

        private void NotifyIcon1_Click(object sender, EventArgs e)
        {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
            this.NotifyIcon1.Visible = false;
        }
        private void Form1_Resize(object sender, EventArgs e)
        {
            this.Hide();
            this.NotifyIcon1.Visible = true;
        }
        #endregion

2019年6月12日 星期三

不同的 Controller 之間導向 View=>以下三種寫法

https://jeffprogrammer.wordpress.com/2016/05/18/asp-net-mvc-redirect-to-view/


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace prjTest.Controllers
{
    public class DefaultController : Controller
    {
        // GET: Default
        public ActionResult Index()
        {
            string virtualPath = System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + HttpRuntime.AppDomainAppVirtualPath;
            System.Web.HttpContext.Current.Response.Redirect(virtualPath + "Apply/Index", true);
            //下面不會跑
            ViewBag.msg = virtualPath;
            return View();
        }
    }
}


WPF聊天室应用(ASP.NET Core SignalR)

  WPF聊天室应用(ASP.NET Core SignalR) https://www.bilibili.com/video/BV1Q741187Si?p=2 https://www.bilibili.com/video/BV1UV411e75T?from=search...