- Jul 18 Mon 2016 10:45
-
建立sql server 預存程序(以新增資料為例,並取得新增資料id)
- Jul 13 Wed 2016 15:26
-
北風資料庫下載並載入SQL SERVER 2012以上版本
下載路徑:https://drive.google.com/folderview?id=0B8BYVFwwzT1ZVjR1T3dxRjNQdGc&usp=sharing
解壓縮後,執行instnwnd.sql (利用 microsoft sql server management studio開啟)
解壓縮後,執行instnwnd.sql (利用 microsoft sql server management studio開啟)
- Jul 08 Fri 2016 21:41
-
製作兩個listbox選項移動

protected void Page_Load(object sender, EventArgs e)
{
//動態產生左右各一的listbox,並做初始值設定-----------開始
ListBox leftlist = new ListBox();
ListBox rightlist = new ListBox();
leftlist.SelectionMode = ListSelectionMode.Multiple;
rightlist.SelectionMode = ListSelectionMode.Multiple;
leftlist.ID = "leftlist";
leftlist.Width = 200;
leftlist.Font.Size = 14;
leftlist.Height = 300;
rightlist.ID = "rightlist";
rightlist.Width = 200;
rightlist.Font.Size = 14;
rightlist.Height = 300;
//動態產生左右各一的listbox,並做初始值設定-----------結束
- Jul 08 Fri 2016 20:06
-
動態建立多個文字框並為其加上事件
protected void Page_Load(object sender, EventArgs e)
{
//動態建立10個文字框;
for (int i = 1; i <= 10; i++)
{
TextBox tb = new TextBox();
tb.ID = "textbox" + i;
tb.Width = 100;
tb.AutoPostBack = true;
{
//動態建立10個文字框;
for (int i = 1; i <= 10; i++)
{
TextBox tb = new TextBox();
tb.ID = "textbox" + i;
tb.Width = 100;
tb.AutoPostBack = true;
- Jul 08 Fri 2016 15:03
-
動態生成表格,並填入九九乘法表

protected void Page_Load(object sender, EventArgs e)
{
Table mytable = new Table();
mytable.GridLines = GridLines.Both;
Page.Controls.Add(mytable);
for(int i = 1; i < 10; i++)
{
TableRow myrow = new TableRow();
mytable.Rows.Add(myrow);
for (int j = 1; j < 10; j++)
{
TableCell mycell = new TableCell();
mycell.Text = j + "×" + i + "=" + i * j;
myrow.Cells.Add(mycell);
}
}
- Jul 07 Thu 2016 17:07
-
以程式來設定控制項的外觀、文字樣式
TextBox1.Style["background-color"] = "#EEEE00";
TextBox1.Style["color"] = "blue";
TextBox1.Style["font-weight"] = "bold";
TextBox1.Style["border-color"] = "green";
TextBox1.Style["font-size"] = "60pt";
TextBox1.Style["color"] = "blue";
TextBox1.Style["font-weight"] = "bold";
TextBox1.Style["border-color"] = "green";
TextBox1.Style["font-size"] = "60pt";
- Jul 05 Tue 2016 22:47
-
將文字檔輸出至網頁
FileStream myFileStream;
long fileSize;
myFileStream = new FileStream(Server.MapPath("/ch01/TextFile.txt"), FileMode.Open);
fileSize = myFileStream.Length;
byte[] Buffer = new byte[(int)fileSize];
myFileStream.Read(Buffer, 0, (int)fileSize);
Response.BinaryWrite(Buffer);
long fileSize;
myFileStream = new FileStream(Server.MapPath("/ch01/TextFile.txt"), FileMode.Open);
fileSize = myFileStream.Length;
byte[] Buffer = new byte[(int)fileSize];
myFileStream.Read(Buffer, 0, (int)fileSize);
Response.BinaryWrite(Buffer);
- Nov 13 Fri 2015 11:11
-
將table置中的Css語法
一般來說我們要將頁面中的table我們會這樣寫
<table align="center">
但是如果要寫在css中的話正常的想法會寫成這樣
table {text-align:center}
但這完全是沒效果的
你必需寫成這樣才會真正的置中
table{
margin-left:auto;
margin-right:auto;
}
<table align="center">
但是如果要寫在css中的話正常的想法會寫成這樣
table {text-align:center}
但這完全是沒效果的
你必需寫成這樣才會真正的置中
table{
margin-left:auto;
margin-right:auto;
}
- Feb 20 Fri 2015 23:03
-
判斷頁數傳值是否為數字,並確定p值大於1,少於總頁數
// 底下這一段IF判別式,是用來防呆,防止一些例外狀況。-- start --
if (Request["p"] == null)
{
p = 1;
}
else
{
if (IsNumeric(Request["p"]))
{
//有任何問題,就強制跳回第一頁(p=1)。
//頁數(p)務必是一個整數。而且需要大於零、比起「資料的總頁數」要少
if ((p != null) & (p > 0) & (p <= Pages))
{
p = Convert.ToInt32(Request["p"]);
}
else
{
p = 1;
}
}
else
{
p = 1;
}
} //上面這一段IF辦別式,是用來防呆,防止一些例外狀況。-- end --
if (Request["p"] == null)
{
p = 1;
}
else
{
if (IsNumeric(Request["p"]))
{
//有任何問題,就強制跳回第一頁(p=1)。
//頁數(p)務必是一個整數。而且需要大於零、比起「資料的總頁數」要少
if ((p != null) & (p > 0) & (p <= Pages))
{
p = Convert.ToInt32(Request["p"]);
}
else
{
p = 1;
}
}
else
{
p = 1;
}
} //上面這一段IF辦別式,是用來防呆,防止一些例外狀況。-- end --
- Feb 20 Fri 2015 23:00
-
計算資料庫筆數,有多少頁數?
//Pages 資料的總頁數。搜尋到的所有資料,共需「幾頁」才能全部呈現?
int Pages = ((RecordCount + PageSize) - 1) / (PageSize); //除法,取得「商」。
int Pages = ((RecordCount + PageSize) - 1) / (PageSize); //除法,取得「商」。
- Feb 01 Sun 2015 17:15
-
c# asp.net 如何判斷變數是數字
static bool IsNumeric(object Expression)
{
// Variable to collect the Return value of the TryParse method.
bool isNum;
// Define variable to collect out parameter of the TryParse method. If the conversion fails, the out parameter is zero.
double retNum;
{
// Variable to collect the Return value of the TryParse method.
bool isNum;
// Define variable to collect out parameter of the TryParse method. If the conversion fails, the out parameter is zero.
double retNum;
- Dec 16 Tue 2014 08:47
-
引用webservice

先加入服務參考,再後置程式碼輸入以下內容即可。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;