using System
using System
SqlConnection thisConnection = new SqlConnection(
@
thisConnection
SqlCommand thisCommand = thisConnection
也可以這樣 // SqlCommand cmd = new SqlCommand();
// cmd
cmmand的sql命令
thisCommand
SqlDataReader thisReader = thisCommand
//用reader讀出表
while (thisReader
{
// Output ID and name columns
Console
thisReader[
// Close reader 用完要關閉
thisReader
// Close connection
thisConnection
From:http://tw.wingwit.com/Article/program/net/201311/15259.html