Time of Update: 2015-01-15
標籤:1、在C#中調用sql自訂函數1.1 純量值函式sql語句調用 select dbo.GetClassIDWithName(1) string strSql = string.Format("select dbo.GetClassIDWithName(‘{0}‘)",dtTime);DataTable dt = DB_Contrast.DB.OleDbHelper.GetDataTable(strSql);1.2 資料表值函式sql語句調用 select *
Time of Update: 2015-01-20
標籤:#!/bin/shcd /var/log/httpd/cat access_log|awk ‘{print $1}‘|sort|uniq -c|sort -n -r|head -n 20 > acp /dev/null access_logcp /dev/null error_logcp /dev/null limit.shcp /dev/null c#awk ‘{print $2}‘ a|awk -F. ‘{print $1"."$2"."$3}‘|sort|uniq >
Time of Update: 2015-01-21
標籤:一、C#關係運算子C#語言的關係運算子是對運算元的比較運算。二、樣本 using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Test{ class Program { static void
Time of Update: 2015-01-21
標籤:一、C# as運算子as運算子用於執行參考型別的顯式類型轉換。請閱讀C#資料類型。as運算子可以用下面的格式表示:expression as type?expression:參考型別的運算式。?type:參考型別。例如:string str = someObject as string;if (str != null){ // someObject is a
Time of Update: 2015-01-20
標籤:windows系統下使用svn的命令需要安裝一個外掛程式,:http://sourceforge.net/projects/win32svn/?source=typ_redirect安裝後程式會自動把安裝目錄下的bin檔案夾設定到系統的環境變數中,為了svn的commit命令可用,我們需要手動設定一下SVR_EDITER這個環境變數,變數的值是notepad。然後重啟電腦(我在安裝後就是重啟電腦後才生效的)。c#的具體代碼如下: private void
Time of Update: 2015-01-21
標籤:cbUserAgent是一個combox ArrayList list = new ArrayList(); Dictionary<string, string> useragents = new Dictionary<string, string>(); /// <summary> /// 初始化combox /// </summary> private
Time of Update: 2015-01-21
標籤:運用DirectoryInfo類的對象我們可以輕鬆的實現對目錄以及和目錄中的檔案相關的操作,假如你要獲得某個目錄F:\Pictures下的所有BMP檔案,那麼通過下面的代碼就可以實現該功能。 上面的代碼中我們首先建立了一個DirectoryInfo對象,然後通過調用該對象的GetFiles方法擷取目錄F:\Pictures下的所有以bmp為副檔名的檔案,該方法返回的值是一個FileInfo類型的數組,每個元素則代表一個檔案。最後,程式還列舉了每個BMP檔案的相關屬性。
Time of Update: 2015-01-19
標籤:using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication6{ public class Program { public static void Main(string[] args) {
Time of Update: 2015-01-19
標籤:sharepoint 資料 web c# listitem C#從Sharepoint上擷取List資料:添加引用:using Microsoft.SharePoint.Client;using System.Data;源碼: public static void getDataFromSPList(string
Time of Update: 2015-01-16
標籤: 最近寫C#串口通訊程式,系統是B/S架構。SerialPort類有一個DataReceived事件,用來接收串口返回的資料,但這種方式在C/S架構下很好用,但B/S就不好處理了。所以寫了一個同步模式接收返回資料的方法,不使用DataReceived事件。經過測試,可以正常使用(不支援多線程調用)。 一、Machine類 1、Machine類有一個靜態變數,定義如下:private static
Time of Update: 2015-01-20
標籤:c# 委託事件機制 C#中的委託事件機制是這種語言的一大亮點,以一種更加安全和高效的方式可以實作類別似C語言中的函數指標,Qt中的訊號槽機制和委託事件機制在實際運用中頗為相似,但是,C#使用上更加方便。下面,我先貼個圖來展示一個事件機制的原理:650) this.width=650;" title="引用其它博文" alt="wKiom1S9v22zuZEDAADWSMO5SeA502.jpg"
Time of Update: 2015-01-16
標籤:轉載:http://outofmemory.cn/code-snippet/1762/C-how-control-method-zhixingshijian-chaoshi-ze-force-quit-method-execution/comments1
Time of Update: 2015-01-16
標籤:今天看別人寫的源碼發現一個特殊的DefaultValueAttribute。使用如下。原始代碼:public class People { private string _Name = "小明"; public string Name { get { return _Name; } set { _Name = value; } }
Time of Update: 2015-01-14
標籤:原文:c#截取字串 幾個經常用到的字串的截取string str="123abc456";int i=3;1 取字串的前i個字元 str=str.Substring(0,i); // or str=str.Remove(i,str.Length-i);2 去掉字串的前i個字元: str=str.Remove(0,i); // or str=str.Substring(i);3 從右邊開始取i個字元: str=str.Substring(str.Length-i);
Time of Update: 2015-01-14
標籤: /// <summary> /// 擷取文字框控制項 /// </summary> /// <param name="hwnd">文字框所在父視窗</param> /// <param name="text">文字框文本,null為搜尋所有</param> /// <param name="iLevel">父視窗上第幾個文字框</
Time of Update: 2015-01-18
標籤:將exe所在的絕對路徑和進程名配置到設定檔中<add key="FilePath" value="D:\ABC\ABCD.Console.exe"/><add key="ProcessName" value="ABCD.Console"/> 代碼如下:/// <summary>/// 進程名/// </summary>private Process dataCenterProcess;//
Time of Update: 2015-01-18
標籤:在正式探索C#的奧秘之前,我們現談一談關於學習方法的問題。人總會是對自己奮鬥努力得來的東西,倍加珍惜。學習也是如此。只有自己遇到問題,想方設法去解決問題,才會刻骨銘心。我所寫的文章,以及老師的教授,乃至所有的自學視頻,僅僅是起一個輔助作用。在裡面你得到的只是一個一個零碎的知識點。時間長了,任何人都可以記住。這僅僅是一個記憶的過程。自己能夠學習到解決問題的辦法才是我們真正要學習的東西。一定要銘記,我們不是學習知識,而是學習解決方案的能力。但是要提高自己解決問題的能力,就必須要把相關的知識學習
Time of Update: 2015-01-22
標籤:小測試看看你理解對幾個:char **argv argv: pointer to char array int (*daytab)[13] daytab: pointer to array[13] of intint *daytab[13] daytab: array[13] of pointer to intvoid *comp() comp: function returning pointer to voidvoid (*comp)() comp:
Time of Update: 2015-01-15
標籤:#include <stdio.h>#include <string.h>#include<stdlib.h>typedef struct ListNode ListNode;typedef unsigned int uint;struct ListNode {uint loop_count;int number;ListNode *next;ListNode *last;};ListNode *p, *q, *start = NULL, *end;/*
Time of Update: 2015-01-14
標籤:刷題 codeforces 水 經過了一個多月的時間,今天終於可以回到正軌了,繼續開始刷CF。題目大意:給出一個只有括弧的字串,求最長“匹配”子串的長度和數量。解題思路:設定數組記錄匹配括弧段的開頭。下面是代碼:#include <set>#include <map>#include <queue>#include