Trusted Authentication
Data Source=ServerName; Initial Catalog=DatabaseName; Integrated Security=SSPI;
SQL Server Security Authentication
Data Source=ServerName; Initial Catalog=DatabaseName; User Id=UserName; Password=UserPassword;
Data Source=ServerName; Initial Catalog=DatabaseName; Integrated Security=SSPI;
Data Source=ServerName; Initial Catalog=DatabaseName; User Id=UserName; Password=UserPassword;
using System.DirectoryServices.AccountManagement;
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
UserPrincipal qbeUser = new UserPrincipal(ctx);
PrincipalSearcher srch = new PrincipalSearcher(qbeUser);

這篇文章受密碼保護,請輸入密碼後查看內容。
在 Form Load 中設定 Button1 的 Attributes 屬性:
btnSubmit.Attributes.Add("onclick", "this.disabled=true;" + GetPostBackEventReference(btnSubmit).ToString());
IE7.0 之後 微軟自定義了一些CSS規則,所以變成很多網站常常不明所以出現破版找不到問題,
很大的原因就是相容性檢視設定,在工具列中的工具,選一下相容性檢視設定,常常就海闊天空了,
不用抓table tag抓到抓狂(根本就不是他的錯啊),使用者只會跟你說網站有問題,後端設定一下
,使用者就不用那麼麻煩要自己按那個鬼,保哥的網站有詳細的教學,參考一下吧
寫程式的人大多會用到,主文擷取微軟的MSDN,雖然微軟的MSDN讓許多人視之如廢材,但沒想到用了其他的SAMPLE問題一堆,微軟這個卻寫的還很清楚,修改過後相關寫法如下:
最一開始記得要先引用
using MailMessage=System.Net.Mail.MailMessage;
寄信相關寫法
簡潔又好用的SQL語法,頂方便的
SELECT 欄位名稱,COUNT(*)/*重複出現的次數*/ FROM member GROUP BY 欄位名稱 HAVING COUNT(*) > 1
/*列出重複出現一次以上的資料*/
最近在寫程式時有用到,主要是因為對方的資料庫不給還原、附加,只他X的給你個SQL 語法介面,要麻你就執行SQL插入,要麻你就等對方幫你匯入,
不過對方說要排隊,所以乾脆自己些產生資料表資料插入語法,引此找了一些特殊的SQL語法:
1.取得資料庫表單數量
select count(*) as totaltablenumber from sysobjects where xtype = 'U';
2.取得資料表名稱(tablename)及欄位數量(columnnumber)
常常用到卻也常常忘記,例如我要如何驗證他是整數,或是只能輸入英文數字,以下提供好用的語法,下列是做成CLASS的方式,當然你也可以直接CALL最後面的正規表示式放在ASP.NET的驗證控制項規則:
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
用ReadOnly是個不錯的用法,問題是如果你要傳給後端去抓取值得時候就抓不到了,
例如日曆用法以下提供一個簡單好用的方式,請加在pageload
textbox1.attributes.add("readonly","true");