Time of Update: 2018-12-06
用系統預存程序Sp_attach_db 來附加資料庫;用系統預存程序sp_addlogin 來新增帳號添加使用者: 1public bool AddUser(string cUserName,string Password,string DB) 2{ 3 System.Data.SqlClient.SqlConnection oCon=new System.Data.SqlClient.SqlConnection("data source=.;initial catalog=master;
Time of Update: 2018-12-06
採用SqlClient方式串連資料庫: int Id =1;string Name="lui";//語句中直接在sql語句中寫添加的參數名,不論參數類型都是如此. SqlCommand cmd = new SqlCommand("",connection1); cmd.CommandText="insert into TUserLogin values(@Id,@Name)";cmd.Parameters.Clear(); cmd.Parameters.Add("@
Time of Update: 2018-12-06
添加引用:COM下的Microsoft Word 11.0 Object Liabraryprivate static object nullobj = System.Reflection.Missing.Value;/**//// <summary> /// search in a DOC file(查詢DOC檔案的內容) /// </summary> /// <param name="fileName"></
Time of Update: 2018-12-06
一定要引用:Microsoft ActiveX Data Objects 2.7Microsoft OLEDB Service Component 1.0 Type
Time of Update: 2018-12-06
最簡單的:--------寫//content是要寫入文本的字串//(@txtPath + @"\" + rid + ".txt");要被寫入的TXT StreamWriter sw = new StreamWriter(@txtPath + @"\" + rid + ".txt"); sw.WriteLine(content); sw.Close();---------讀//folder被讀取的檔案路徑text = File.ReadAllText(folder,
Time of Update: 2018-12-06
由於XML的易共用性等眾多優點,XML技術越來越多地被應用於企業資料處理等領域,如應用於企業報表、新聞發布、會計資料處理等等。 XML正快速成為從中介層傳送資料到案頭的工具,由於XML的資料可以通過中介層代理與多種後端(資料庫)源整合,目前絕大多數資料庫製造商已全面支援XML技術,提供了各種強大功能處理XML資料。 Microsoft的.NET圍繞XML這一核心提供了一個強大而快速的開發工具——C#,它具有前所未有的高開發效率,特別是在XML編程方面。 C#提供了許多相關類處理XML資料,
Time of Update: 2018-12-06
本文章講敘了怎樣在c#裡處理xml文檔,都是些比較基本的。首先,我們先自建一個xml文檔,如下:<?xml version="1.0" encoding="UTF-8"?><peoplelist> <person> <name>Tom Stafford</name> <title>CFO</title> </person> <person> <name>
Time of Update: 2018-12-06
啟動類:Program.csusing System;using System.Collections.Generic;using System.Windows.Forms;namespace FontColor{ static class Program { /// <summary> /// 應用程式的主進入點。 /// </summary> [STAThread] static
Time of Update: 2018-12-06
步驟一:建立一個文字檔。步驟二:將以下代碼複製進文本,然後儲存。-----------建立記事本並輸入以下代碼-----------@echo offecho 藍藍系統垃圾清理正在為您工作,請稍等……del /f /s /q %systemdrive%\*.tmpdel /f /s /q %systemdrive%\*._mpdel /f /s /q %systemdrive%\*.logdel /f /s /q %systemdrive%\*.giddel /f /s /q
Time of Update: 2018-12-06
private void getFirstCode() { Num = 0; conn = "Provider=SQLNCLI;Data Source=192.168.0.111,1433;Database=MIS;UID=sa;PWD=;"; string WordBegin = ""; string TermName = ""; sql = "select
Time of Update: 2018-12-06
我在做項目的時候需要將檔案進行壓縮和解壓縮,於是就從http://www.icsharpcode.net下載了關於壓縮和解壓縮的源碼,但是下載下來後,面對這麼多的代碼,一時不知如何下手。只好耐下心來,慢慢的研究,總算找到了門路。針對自己的需要改寫了檔案壓縮和解壓縮的兩個類,分別為ZipClass和UnZipClass。其中碰到了不少困難,就決定寫出來壓縮和解壓的程式後,一定把源碼貼出來共用,讓首次接觸壓縮和解壓縮的朋友可以少走些彎路。下面就來解釋如何在C#裡用http://www.icshar
Time of Update: 2018-12-06
一周從周日算起 DateTime mDatetime=new DateTime(year,1,1);//year為要求的那一年 int firstweekfirstday=Convert.ToInt32(mDTime.DayOfWeek);//一年中第一天是周幾 days=(double)(6-firstweekfirstday); DateTime secondweekfisrtday=mDTime.AddDays(days);第二周一
Time of Update: 2018-12-06
using System; using System.Collections.Generic; using System.Windows.Forms; using System.Data.SqlClient; using System.Data; using System.ServiceProcess; namespace AdminZJC.DataBaseControl { /// <summary> /// 資料庫操作控制類 /// </summary>
Time of Update: 2018-12-06
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> public bool ReadZfsFile(string ZfsFile) {try { FileStream fs = new FileStream(ZfsFile, FileMode.Open,
Time of Update: 2018-12-06
//前台 代碼Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-06
Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-06
Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-06
最近發現了一段C程式很有意思,與大家分享。來源程式如下:#include <stdio.h>main(int
Time of Update: 2018-12-06
Form1 f1 =new Form1();f1.parameter["XXX"]="XXX";(字串)f1.show();當在f1中使用這個值時這樣接值string s = type(me.parameter["XXX"],"string")VB.NET的文法我寫的這幾句可能有錯誤但大意就是這樣了我後來看了一下這個DLL原來這個parameter是個hashtable像他這種表單間的傳值的方法可以傳個種類型的值我的問題就是:這個父表單應該怎麼寫,讓繼承他的表單都能實現我說的這種方法來傳值??
Time of Update: 2018-12-06
TcpClient 為 TCP 網路服務提供用戶端串連。System.Object System.Net.Sockets.TcpClient[C#]public class TcpClient : IDisposable備忘TcpClient 類提供了一些簡單的方法,用於在同步阻塞模式下通過網路來串連、發送和接收流資料。為使 TcpClient 串連並交換資料,使用 TCP ProtocolType 建立的 TcpListener 或 Socket