using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string sqlcmd ="select top 20 id,test_time,title,summary from test";
}
private void ConnectDB(string ConnectionString,string sqlcmd)
{
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = WebConfigurationManager.ConnectionStrings[ConnectionString].ConnectionString;
SqlDataReader dr = null;
SqlCommand cmd = new SqlCommand(sqlcmd,Conn);
try
{
Conn.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
}
}
catch (Exception ex)
{
Response.Write("<b>Error Message----</b>" + ex.ToString());
}
finally {
if (dr != null) {
cmd.Cancel();
dr.Close();
}
if (Conn.State == ConnectionState.Open) {
Conn.Close();
Conn.Dispose();
}
}
}
}
2014年11月25日 星期二
訂閱:
張貼留言 (Atom)
讓ASP.NET網站在開發除錯時期擁有WEB.CONFIG文件轉換功能
ref: https://blog.kkbruce.net/2016/09/enabling-xml-document-transforms-for-all-asp-net-web-by-develop-time.html#.XoP1KGMzbRY
-
https://docs.microsoft.com/zh-tw/dotnet/framework/data/transactions/using-system-transactions-in-aspnet <system.web> <co...
-
ASP 判断Session变量是否存在的4种方法 1 If Session("sesName") = "" Then ... 2 If Session("sesName") = Empty Then ... 3 If...
-
IS NULL 判斷值是否為NULL 學號 成績 S0001 56 S0001 73 S0002 92 S0002 63 S0003 92 S0003 70 S0004 75 S0004 88 S0004 68 S0005 NU...
沒有留言:
張貼留言