Time of Update: 2018-12-08
頁面初始化,介面:Server name文字框擷取焦點時候,介面(這裡可以改成你登入的驗證碼):可以載入SQL Server服務列表,也是我的簡易SQL查詢分析器評論中靜夜妙思給予的方法,非常感謝!載入列表如所示:可以隨意地點擊添加到Server name中,登入時所示:文字框驗證都寫好了!還有Authentication驗證方式,windows驗證下面Login,Password文字框禁掉!由於時間原因,不了demo.html(全部前台代碼,js/css還沒分檔案儲存體) 複製代碼 代碼如下:
Time of Update: 2018-12-08
下面是啟動並執行核心代碼:複製代碼 代碼如下:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; /* * * 整理:張曉天 * Q Q:977602650 * 日期:2012-03-
Time of Update: 2018-12-08
C# 泛型和數組在 C# 2.0 中,下限為零的一維數組自動實現 IList<T>。這使您可以建立能夠使用相同代碼逐一查看數組和其他集合類型的泛型方法。此技術主要對讀取集合中的資料很有用。IList<T> 介面不能用於在數組中添加或移除元素;如果試圖在此上下文中調用 IList<T> 方法(如數組的 RemoveAt),將引發異常。下面的程式碼範例示範帶有 IList<T> 輸入參數的單個泛型方法如何同時逐一查看列表和數組,本例中為整數數組。 C#
Time of Update: 2018-12-08
這下可把我難住了,難道要 在開發的代碼中一個一個地設定想要的名稱,然後重新編譯,再註冊成服務? 但是如果將來又要換個名稱呢?再重新設定、 編譯、註冊一遍?這樣操作太麻煩了! 於是我就想能不能通過在安裝的時候進行配置,比如加一個xml檔案記錄要安裝的服務的服務名等資訊,每次安裝前修改該xml檔案就可以了。 操作: 1、首先添加一個設定檔到服務主程式的根目錄,取名“ServiceSetting.xml”: 複製代碼 代碼如下:<?xml version="1.0" encoding="utf-
Time of Update: 2018-12-08
項目中要用到以截斷的方式取小數點後兩位,故寫了以下方法: 複製代碼 代碼如下:/// <summary> /// 將小數值按指定的小數位元截斷 /// </summary> /// <param name="d">要截斷的小數</param> /// <param name="s">小數位元,s大於等於0,小於等於28</param> /// <returns></returns> public
Time of Update: 2018-12-08
1.使用winapi “SetParent” 介面: 複製代碼 代碼如下:[DllImport("user32.dll", SetLastError = true)] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); 複製代碼 代碼如下:control.Dock = DockStyle.None; control.Left = 0; control.Top = 0; control.Width =
Time of Update: 2018-12-08
C#是一門物件導向的語言,具有物件導向的基本特徵,抽象、封裝、繼承、多態等性質。學習C#除了一些基本的文法,還得學習一些新的特性,比如說:泛型、多線程、集合、反射等,下面就選其中一些來學習吧! 一、C#中的各種器 A、 C#構造器-建構函式 如下: 複製代碼 代碼如下://構造器1 public Products(int id) { _Id = id; } //構造器2,使用this來調用構造器1 public Products(int id, string Name, string Band)
Time of Update: 2018-12-08
例如,下面代碼: 複製代碼 代碼如下:class Program { static void Main(string[] args) { Console.WriteLine(Sum(1)); Console.WriteLine(Sum(1, 2, 3)); Console.WriteLine(Sum(1, 2, 3, 4, 5)); Console.ReadKey(); } private static int Sum(params int[] values) { int sum = 0;
Time of Update: 2018-12-08
開始用的.net 內建的DataContractJsonSerializer進行序列化和還原序列化,當代碼寫完以後,調試,我X(原諒我的髒話,因為確實讓我生氣),實體因為有[DataContractAttribute(IsReference=true )] 這樣一個屬性,提示不能序列化,當然手改一下啦,改完以後,提示基類EntityObject 的這個屬性不可以 MY God!! 後來也是因為DataContractJsonSerializer 還原序列化成集合的時候不好使,所以才下定決心廢棄。
Time of Update: 2018-12-08
從個小例子開始: 複製代碼 代碼如下:int[] intArray = new int[]{2,3,6,1,4,5}; Array.Sort(intArray); Array.ForEach<int>(intArray,(i)=>Console.WriteLine(i)); 這個例子定義了一個int數組,然後使用Array.Sort(arr)靜態方法對此數組進行排序,最後輸出排序後的數組。以上例子將毫無意外的依次輸出1,2,3,4,5,6.
Time of Update: 2018-12-08
複製代碼 代碼如下:/// <summary> /// 安裝的excel的版本,0為沒有安裝,大於1說明安裝了多個. /// </summary> /// <returns></returns> public static List<string> ExcelVersion() { List<string> list = new List<string>(); List<string> lisemp
Time of Update: 2018-12-08
當我們需要在後台讀取多個關鍵字時,我們可以先把背景資料庫讀取到一個數組中(在資料庫添加多個關鍵詞時用“,”隔開): 複製代碼 代碼如下:public string[] str; //添加一個公用數組一遍jquery調用 protected void Page_Load(object sender, EventArgs e) { string str1 = 讀取資料庫的關鍵詞; str=str1.Split(','); } 頁面的JQuery: <html s> <head
Time of Update: 2018-12-08
複製代碼 代碼如下:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Drawing; using System.Drawing.Drawing2D; using System.IO; using System.Drawing.Imaging; using System.Collections; namespace Curve { public
Time of Update: 2018-12-08
複製代碼 代碼如下://首先匯入命名空間 using System.Runtime.InteropServices; /// <summary> /// 在指定進程的虛擬位址空間中保留或開闢一段地區..除非MEM_RESET被使用,否則將該記憶體地區初始化為0. /// </summary> /// <param
Time of Update: 2018-12-08
複製代碼 代碼如下:// 事件: 改變列寬的時候 private void ColumnWidthChange(object sender, ColumnWidthChangingEventArgs e) { // 如果調整的不是第一列,就不管了 if (e.ColumnIndex > 0) return; // 取消掉正在調整的事件 e.Cancel = true; // 把新寬度恢複到之前的寬度 e.NewWidth =
Time of Update: 2018-12-08
JS代碼: Code: 複製代碼 代碼如下:var _MaxPageSize = 0; var _PageSize = 5; var _IsUpDown = false; function InitPage(funName, currentPageSize, maxPageSize, pageSize, isUpDown) { _FunName = funName; _CurrentPageSize = currentPageSize; _MaxPageSize = maxPageSize; _
Time of Update: 2018-12-08
在網上找了找,發現有三種方法可以訪問到前台代碼: 第一種,OnClientClick (vs2003不支援這個方法) <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="client_click()" OnClick="Button1_Click" /> client_click() 就是javascript的一個方法。 第二種,Button1.Attributes.Add("onclick", "
Time of Update: 2018-12-08
WebToolkit類: 複製代碼 代碼如下:using System; using System.Net.Sockets; using System.Text; namespace ConsoleApplication1 { class WebToolkit { /// <summary> /// Url結構 /// </summary> struct UrlInfo { public string Host; public int Port; public
Time of Update: 2018-12-08
開時始,得到的中文檔案中的字元是亂碼的,鳥符號看的頭暈。於是就細究streamreader讀取的編碼格式,預設的編碼是ascii,單位元組的,就嘗試utf8,亂碼;嘗試gb2312,OK! 可另一個問題又出現了,得到的兩個檔案的行數都不到1500行,嘗試N次還是不行,很鬱悶。google了下,看到try catch,就想到釋放緩衝區,結果很HAPPY! 複製代碼 代碼如下:private static void FnFileProcess() { StreamReader reader =
Time of Update: 2018-12-08
一、DataTable簡介 (1)建構函式 DataTable() 不帶參數初始化DataTable 類的新執行個體。 DataTable(string tableName) 用指定的表名初始化DataTable 類的新執行個體。 DataTable(string tableName, string tableNamespace) 用指定的表名和命名空間初始化DataTable 類的新執行個體。 (2) 常用屬性 CaseSensitive 指示表中的字串比較是否區分大小寫。