string updatesql = "Update t_member Set ...........//你的sql語法
string connStr="server=xxxxxxx; uid=sa; password=xxxxxxx; initial catalog=xxxxxxx;" ;<--你的連線
SqlConnection oCn = new SqlConnection(connStr);
SqlCommand Comm = new SqlCommand(updatesql,oCn);
Comm.Connection.Open();
Comm.ExecuteNonQuery();
Comm.Connection.Close();
2011年12月27日 星期二
2011年12月26日 星期一
[Javascript]如何讓IE9, IE8, IE7, IE6關閉視窗時不彈出對話訊息
script type="text/javascript">
function closeW() {
window.opener = null;
window.open('', '_self');
window.close();
}
/script>
onclientclick="alert('已刪除!');closeW();"
function closeW() {
window.opener = null;
window.open('', '_self');
window.close();
}
/script>
onclientclick="alert('已刪除!');closeW();"
[asp.net] showModalDialog
asp:Button ID="btn_select" runat="server" Text="選擇權限/新增群組"
onclick="btnSelect_Click" Width="133px" OnClientClick="showModalDialog('select_group.aspx',window,'dialogWidth:400px; dialogHeight:300px; center:yes; status:0;')" />
onclick="btnSelect_Click" Width="133px" OnClientClick="showModalDialog('select_group.aspx',window,'dialogWidth:400px; dialogHeight:300px; center:yes; status:0;')" />
2011年12月22日 星期四
[asp.net] [c#] session使用方法
//建立
Session.Add("sessionName", "123");
//or
Session["sessionName"] = "123";
//取值
string s = Session["sessionName"].ToString();
//移除
Session.Remove("sessionName");
Session.Add("sessionName", "123");
//or
Session["sessionName"] = "123";
//取值
string s = Session["sessionName"].ToString();
//移除
Session.Remove("sessionName");
2011年12月11日 星期日
[javascript] checkbox 全選
script type="text/javascript"> //checkbox全選
function SelectAllCheckBoxes(spanChk)
{
elm = document.forms[0];
for (i = 0; i <= elm.length - 1; i++) { if (elm[i].type == "checkbox" && elm[i].id != spanChk.id) { if (elm.elements[i].checked != spanChk.checked) elm.elements[i].click(); } } } /script>
asp:CheckBox ID="CheckAll" runat="server" onclick="javascript: SelectAllCheckBoxes(this);" Text="全選" Font-Size="8" width="50" Tootip="按一次全選,再按一次取消全選" />
function SelectAllCheckBoxes(spanChk)
{
elm = document.forms[0];
for (i = 0; i <= elm.length - 1; i++) { if (elm[i].type == "checkbox" && elm[i].id != spanChk.id) { if (elm.elements[i].checked != spanChk.checked) elm.elements[i].click(); } } } /script>
asp:CheckBox ID="CheckAll" runat="server" onclick="javascript: SelectAllCheckBoxes(this);" Text="全選" Font-Size="8" width="50" Tootip="按一次全選,再按一次取消全選" />
2011年12月9日 星期五
[C#] 使用Split分割用多字串分隔的字串
//string 版
string ss = "sasa, test01, test02, admin, jimmy, jack, benson, ";
string[] splitResult = ss.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0;i < splitResult.Length; i++)
//char 版
string ss = "sasa, test01, test02, admin, jimmy, jack, benson, ";
string[] splitResult = ss.Split(new char[] { ',' });
string ss = "sasa, test01, test02, admin, jimmy, jack, benson, ";
string[] splitResult = ss.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0;i < splitResult.Length; i++)
//char 版
string ss = "sasa, test01, test02, admin, jimmy, jack, benson, ";
string[] splitResult = ss.Split(new char[] { ',' });
2011年12月7日 星期三
鍵盤按鍵 與 Javascript key codes 對應表
Key CodesThis document is written by Helge Willum Larsen
It contains a list of all "onkeypress", "onkeydown" and "onkeyup" KeyCodes in
JavaScript, that can be typed with a DANISH KEYBOARD !!!
Other keyboards probably have other KeyCodes.
The first section is tested with the Microsoft Internet Explore 5.0 and the Netscape
Communicator 4.51. At this time, Netscape didn't support "onkeydown" and "onkeyup".
I strongly recommend that you use the "onkeypress" function.
It has the greatest browser-compatibility.
Otherwise, you can maybe use some of the codes in the bottom of the page:
________________________________________________________________________________
KeyCodes (ALL keyboards): onkeypress Tested with Internet Explore 5.0
By: Helge Willum Larsen and Netscape Communicator 4.51
on a DANISH keyboard
________________________________________________________________________________
SUPPORTS MULTIPLE KEYPRESSES:
[A] = [a]
[Shift] + [A] = [A]
[CapsLock] + [A] = [A]
[Shift] + [CapsLock] + [A] = [a]
ALL KEYS THAT CREATES THE SAME OUTPUT, HAVE THE SAME KEYCODES !
[NumPad 1] is the same as [1] (if NumLock)
[NumPad +] is the same as [+]
DOES NOT SUPPORT ARROW-KEYS, DELETE, INSERT, SHIFT, ALT, CTRL, TAB, ESC...!
But it supports [Return / Enter] and [Backspace]
________________________________________________________________________________
Button: keyCode:
[BackSpace] 8
[Return / Enter] 13
[!] 33
["] 34
[#] 35
[$] 36
[%] 37
[&] 38
['] 39
[(] 40
[)] 41
[*] 42
[+] 43
[,] 44
[-] 45
[.] 46
[/] 47
[0] 48
[1] 49
[2] 50
[3] 51
[4] 52
[5] 53
[6] 54
[7] 55
[8] 56
[9] 57
[:] 58
[;] 59
[<] 60
[=] 61
[>] 62
[?] 63
[@] 64
[A] 65
[B] 66
[C] 67
[D] 68
[E] 69
[F] 70
[G] 71
[H] 72
[I] 73
[J] 74
[K] 75
[L] 76
[M] 77
[N] 78
[O] 79
[P] 80
[Q] 81
[R] 82
[S] 83
[T] 84
[U] 85
[V] 86
[W] 87
[X] 88
[Y] 89
[Z] 90
[[] 91
[\] 92
[]] 93
[^] 94
[_] 95
[`] 96
[a] 97
[b] 98
[c] 99
[d] 100
[e] 101
[f] 102
[g] 103
[h] 104
[i] 105
[j] 106
[k] 107
[l] 108
[m] 109
[n] 110
[o] 111
[p] 112
[q] 113
[r] 114
[s] 115
[t] 116
[u] 117
[v] 118
[w] 119
[x] 120
[y] 121
[z] 122
[{] 123
[|] 124
[}] 125
[~] 126
[�] 163
[�] 164
[�] 167
[�] 168
[�] 180
[�] 189
[�] 197
[�] 198
[�] 216
[�] 229
[�] 230
[�] 248
________________________________________________________________________________
KeyCodes (DANISH keyboard): onkeydown / onkeyup Tested with Internet
Explore 5.0)
By: Helge Willum Larsen
________________________________________________________________________________
DOES NOT SUPPORT MULTIPLE KEYPRESSES !
ALL KEYS HAVE THEIR OWN, INDIVIDUAL KEYCODE !
[NumPad 1] is NOT the same as [1]
[NumPad +] is NOT the same as [+]
________________________________________________________________________________
Button: keyCode: NumLock: CapsLock: ScrollLock:
[BackSpace] 8 - - -
[Tab] 9 - - -
[NumPad 5] 12 no - -
[Return / Enter] 13 - - -
[Shift] 16 - - -
[Ctrl] 17 - - -
[Alt] 18 - - -
[Pause / Break] 19 - - -
[CapsLock] 20 - - -
[Esc] 27 - - -
[Space] 32 - - -
[Page Up] 33 - - -
[Page Down] 34 - - -
[End] 35 - - -
[Home] 36 - - -
[LeftArrow] 37 - - -
[UpArrow] 38 - - -
[RightArrow] 39 - - -
[DownArrow] 40 - - -
[PrintScreen / SysRq] 44 - - -
[Insert] 45 - - -
[Delete] 46 - - -
[0] 48 - - -
[1] 49 - - -
[2] 50 - - -
[3] 51 - - -
[4] 52 - - -
[5] 53 - - -
[6] 54 - - -
[7] 55 - - -
[8] 56 - - -
[9] 57 - - -
[A] 65 - - -
[B] 66 - - -
[C] 67 - - -
[D] 68 - - -
[E] 69 - - -
[F] 70 - - -
[G] 71 - - -
[H] 72 - - -
[I] 73 - - -
[J] 74 - - -
[K] 75 - - -
[L] 76 - - -
[M] 77 - - -
[N] 78 - - -
[O] 79 - - -
[P] 80 - - -
[Q] 81 - - -
[R] 82 - - -
[S] 83 - - -
[T] 84 - - -
[U] 85 - - -
[V] 86 - - -
[W] 87 - - -
[X] 88 - - -
[Y] 89 - - -
[Z] 90 - - -
[Turn Off] (special) 94 - - -
[Sleep] (special) 95 - - -
[NumPad 0] 96 yes - -
[NumPad 1] 97 yes - -
[NumPad 2] 98 yes - -
[NumPad 3] 99 yes - -
[NumPad 4] 100 yes - -
[NumPad 5] 101 yes - -
[NumPad 6] 102 yes - -
[NumPad 7] 103 yes - -
[NumPad 8] 104 yes - -
[NumPad 9] 105 yes - -
[NumPad *] 106 - - -
[NumPad +] 107 - - -
[NumPad -] 109 - - -
[NumPad ,] 110 - - -
[NumPad /] 111 - - -
[F1] 112 - - -
[F2] 113 - - -
[F3] 114 - - -
[F4] 115 - - -
[F5] 116 - - -
[F6] 117 - - -
[F7] 118 - - -
[F8] 119 - - -
[F9] 120 - - -
[F10] 121 - - -
[F11] 122 - - -
[F12] 123 - - -
[NumLock] 144 - - -
[ScrollLock] 145 - - -
[+] (next to [0]) 187 - - -
[,] 188 - - -
[-] (next to [.]) 189 - - -
[.] 190 - - -
[�] 192 - - -
[�] (next to [+]) 219 - - -
[�] (next to [1]) 220 - - -
[�] 221 - - -
[�] 222 - - -
[<] (next to [Z]) 226 - - -
[Wake Up] (special) 255 - - -
________________________________________________________________________________
________________________________________________________________________________
Functions: Tested with Internet Explore 5.0
By: Helge Willum Larsen and Netscape Communicator 4.51
________________________________________________________________________________
|
訂閱:
文章 (Atom)