Time of Update: 2016-10-02
標籤:public void BatchInsertIntoAccess(DataTable dt) { ADODB.Connection cn; ADODB.Recordset rs; string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\FileTmp\MMSCRM.mdb;Persist Security Info=False";
Time of Update: 2016-09-27
標籤: C#操作SQL Float類型,資料會多很多小數,原來是C#的float和sql的float類型不一致。以下是資料庫中與C#中的資料類型對照。 /// <summary> /// 資料庫中與C#中的資料類型對照 /// </summary> /// <param name="type"></param> ///
Time of Update: 2016-10-02
標籤:1,結構體不能出現在繼承關係中,除了繼承介面。 結構體不能繼承類或結構,也不能被類或結構繼承,只可以繼承介面。2,struct不能定義預設建構函式(無參建構函式),也不能定義解構函式。class對這兩點都無限制。3,如果struct提供了帶參建構函式,則它的所有欄位(變數)都必須在建構函式中初始化,否則編譯報錯。class對此無限制。4,成員預設修飾符都是private,在C++中則預設為public
Time of Update: 2016-10-02
標籤:可空類型,文法: Nullable<int> inullx = 10; int? inully =
Time of Update: 2016-10-01
標籤:C#中定義常量的方式有兩種,一種叫做靜態常量(Compile-time constant),另一種叫做動態常量(Runtime constant)。前者用“const”來定義,後者用“readonly”來定義。 對於靜態常量(Compile-time constant),它的書寫方式如下: public static const int MAX_VALUE = 10;
Time of Update: 2016-10-01
標籤:1,字串遍曆不同處:例: str = "漢字ABCabc"C#可以使用str[i]取得字串中的漢字字元和拼音字元:Str[0] :漢Str[1]:字Str[2] : A依次類推。LUA中:Str[1] : nilStr[2]: nil…全為nil, 文法不支援這樣的下標功能,只有string.byte(str, i)來取得某位元組的值,對於漢字,UNICODE編碼下,分別取得高位元組,低位元組的值,而沒法像C#那樣一次取得整個漢字。 LUA中只能使用string.
Time of Update: 2016-10-01
標籤:1,繼承,若基類為帶參建構函式,則子類也必須有帶參建構函式。若基類有無參和有參建構函式,則基類可以不提供有參建構函式。2,virtual 與 abstract 區別 abstract class abclass { virtual protected void Func() { }
Time of Update: 2016-10-01
標籤:1.命名空間下的元素的預設存取修飾詞 public : 同一程式集的其他任何代碼或引用該程式集的其他程式集都可以訪問該類型或成員。internal : 同一程式集中的任何代碼都可以訪問該類型或成員,但其他程式集不可以訪問。 2.各類型中的成員的預設存取修飾詞剩下的修飾符主要是正對繼承這個語言特性的,擁有繼承的類型有兩個類(class)和介面(interface)。public,internal同樣可以用於類型成員。private :
Time of Update: 2016-09-25
標籤:方法一首先,先簡單介紹一下MD5MD5的全稱是message-digest algorithm 5(資訊-摘要演算法,在90年代初由mit laboratory for computer science和rsa data security inc的ronald l. rivest開發出來, 經md2、md3和md4發展而來。MD5具有很好的安全性(因為它具有無法復原的特徵,加過密的密文經過解密後和加密前的東東相同的可能性極小)引用 using
Time of Update: 2016-09-25
標籤:---恢複內容開始---using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.IO;using SendNote;namespace NetworkRelay//此命名空間關於網路繼電器{class NetworkRelayControl//網路繼電器控制類{/* static void Main(string[]
Time of Update: 2016-09-25
標籤:簡單認識.NET架構 (1)首先我們得知道 .NET架構具有兩個主要組件:公用語言進行時CLR(Common Language Runtime)和架構類庫FCL(Framework Class Library) 配圖: &
Time of Update: 2016-09-25
標籤:常用產生驗證碼執行個體封裝:/// <summary>/// 產生記憶體位元影像/// </summary>/// <param name="Code"></param>/// <returns></returns>public static Bitmap GetCode(out string Code){ int imgWidth = 80; int imgHeight = 40;
Time of Update: 2016-09-22
標籤:第一次寫部落格,寫的不好休怪哈。 版本1:最簡單的單例模式方法一:public class MySingleton { private MySingleton() //建構函式,注意private { } private static MySingleton _Entity = null; //私人欄位 public static MySingleton Entity //公用屬性 {
Time of Update: 2016-09-25
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms; 10 1
Time of Update: 2016-09-23
標籤:1、PrinterDocument PrinterDocument是主要的列印控制項,列印的時候必須添加它是對PrinterDocument類的實現,通過它的PrinterPage事件可以設定列印的內容。2、PrinterDialog
Time of Update: 2016-09-23
標籤: protected static object MObjLock = new object();//同步鎖 public string GetData(int mId) { Monitor.Enter(MObjLock);//lock string data = string.Empty; try { //你的代碼
Time of Update: 2016-09-22
標籤:概念相當於是一個規則,完成是為了約束(統一)類的行為,介面光說而不做。介面是一種規範,也是一種功能的體現。 在生活USB介面就類似我們程式裡說的介面,定義了一個規定尺寸規格的插口,不管你是行動數據線還是移動硬碟等裝置,只要你有資料線實現這個介面,就可以使用這個介面帶來的功能。 介面命名規範一般以I開頭文法:[存取修飾詞] interface 介面名{ &
Time of Update: 2016-09-22
標籤:多表單:1、哪個是主表單問題:主表單隱藏了,關閉其它表單後,沒有將主表單顯示/關閉,那麼程式就關不上了 (1)、建構函式傳值,將表單傳到另一個表單中去2、表單只能開啟一個 建立一個全域的泛型集合,為了放置全部開啟的表單 (1)、在表單開啟之前,判斷集合中是否有name一致的表單,如果有就說明已經開啟了,就不要再開啟了 問題:當表單開啟了,關閉後,就無法再次開啟了 辦法:當表單關閉時,清除Form1中集合中的此表單對象記錄
Time of Update: 2016-09-22
標籤:讀設定檔與寫設定檔的核心代碼: [DllImport("kernel32")] // 讀設定檔方法的6個參數:所在的分區(section)、索引值、 初始預設值、 StringBuilder、 參數長度上限、設定檔路徑 private static extern int GetPrivateProfileString(string section, string key, string
Time of Update: 2016-09-22
標籤:版本1:最簡單的單例模式public class MySingleton { private MySingleton() //建構函式,注意private { } private static MySingleton _Entity = null; //私人欄位 public static MySingleton Entity //公用屬性 { get