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日 星期二
DropDownList
for (int i = 0; i < (int)DropDownList1.Items. Count; i++)
{
if (DropDownList1.Items[i]. Selected)
{
Session["my_color"] = DropDownList1.Items[i].Value;
Session["my_name"] = TextBox1.Text;
Response.Redirect("AJAX_Case_ 2.aspx"); //--前往聊天室的主畫面(AJAX版)
}
}
訂閱:
文章 (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...