Time of Update: 2015-01-14
標籤:內容不全,以後會添加。C#與 SQL 連結。1.連結字串配置資訊儲存於App.config中 <!--串連資料庫字串--> <connectionStrings> <add name="DBStrConn" connectionString="Data Source=.; initial Catalog=資料庫; user id=使用者名稱; password=密碼"/> </connectionStrings>2.添加
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-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-19
標籤:using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Runtime.Serialization.Formatters.Binary;using System.Text;namespace ConsoleApplication1{ public class Program { public static void
Time of Update: 2015-01-15
標籤:靜態類 靜態類與非靜態類的重要區別在於靜態類不能執行個體化,也就是說,不能使用 new 關鍵字建立靜態類類型的變數。在聲明一個類時使用static關鍵字,具有兩個方面的意義:首先,它防止程式員寫代碼來執行個體化該靜態類;其次,它防止在類的內部聲明任何執行個體欄位或方法。 靜態類是自C# 2.0才引入的,C#
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 FileList{ public class Program { public static void Main(string[] args) {
Time of Update: 2015-01-19
標籤:1.編寫擴充方法類using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CSharpCharacteric{ /// <summary> /// 擴充方法類 /// </summary> public static class Extension { /// <summary>
Time of Update: 2015-01-15
標籤: /// <summary> /// 二分尋找 /// </summary> /// <param
Time of Update: 2015-01-19
標籤: try { string filePath = Application.StartupPath + "tst.txt"; FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.None); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("");
Time of Update: 2015-01-14
標籤:百度地圖 c# 地圖開發 在《C#的百度地圖開發(二)轉換JSON資料為相應的類》一文中,我們得到了百度座標,現在依據這一座標來擷取相應的資訊。下面是相應的代碼public class BaiduMap{ /// <summary> /// 依據座標擷取定位資訊的URL模板。 /// 參數1:百度地圖API的KEY。 //
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-15
標籤:使用參數化 DbCommand 的一個缺點是需要參數的代碼將僅適用於支援相同文法的提供者。OLEDB、SqlClient 和 Oracle 提供者全部使用不同的文法。例如,用於命名和指定參數的 SQL 文法使用 @ 符號,OLEDB 參數文法需要使用問號 (?) 作為參數預留位置,而 Oracle 提供者使用冒號 (:)。 string sqlstr = " select * from table where [email protected] and [email
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-13
標籤:1、匯入 匯入對話方塊:OpenFileDialog private void sbtnsb_Click(object sender, EventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "匯入檔案包(*.bak)|*.bak";//副檔名
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-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-18
標籤:dcmtk dicom c-store dcmqrscp movescu 背景:
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;/*