易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net平台上连接数据库

 今天纠结了一上午的问题,于下午3点12分尘埃落定!
事情是这样的:
作为一个里程碑记录下吧,也算是我第一次将asp.net与数据库结合,并完成从软件编程到web的过渡。
在此感谢今天为我解决问题的“杀手”(也称老道),还有以前为我解决问题的大队、御风、华哥等牛...
言归正传,本文介绍一下怎样在asp.net平台上连接数据库:(C#编写的软件连接数据库见前几篇)
 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Web.Services.Description;
public partial class _Default : System.Web.UI.Page
{
static DataSet ds;
int index;
protected void Page_Load(object sender, EventArgs e)
{
//set mode of textbox2 as password
//在asp.net中设置textbox 属性为password (C#中是passwordchar = ……)
TextBox2.TextMode = TextBoxMode.Password ;
//count the num of user,as we can add the new user with index++(as id)
string strConnection = ConfigurationManager.AppSettings["Str.Properties.Settings.masterConnectionString"].ToString();
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
string sql = "count user num";
sql="select userid as userid,name as name from judging";
SqlDataAdapter adp = new SqlDataAdapter(sql, objConnection);
ds = new DataSet();
ds.Clear();
adp.Fill(ds, "judging");
index = ds.Tables[0].Rows.Count+1;
}

//Register function
protected void Button1_Click(object sender, EventArgs e)
{
/******************method 1*******************/
//string strConnection = "Data Source=ZRQ-PC;";
//strConnection += "Initial Catalog=master;Integrated Security=True";
//SqlConne


相关文档:

ASP.NET 页面事件执行顺序 收藏

ASP.NET 页面事件执行顺序 收藏
过程描述
下面是ASP.NET页面初始的过程:
1. Page_Init();
2. Load ViewState;
3. Load Postback data;
4. Page_Load();
5. Handle control events;
6. Page_PreRender();
7. Page_Render();
8. Unload event;
9. Dispose method called;
下面对其中的一些过程作下描述:
1. Pa ......

ASP.NET 中的设计模式之MVC篇


ASP.NET 中的设计模式之MVC篇

 
ASP.NET
中的设计模式之
MVC

设计模式
MVC
页面控制器

模板与
Page
基类
设计模式
软件开发中,软件复用和团队协作都一直是最为人们关注的重要问题之一。有趣的是,这两个似乎属于软件工程范畴的问题都有一个共同的技术方面的解决之道:设计模式。
  ......

ASP.NET web app performance issue ThreadPool

 
One of my bank customers planned to roll out a new ASP.NET web application serving as their critical internet banking portal. They faced some weird performance issue in their UAT environment. They noticed the CPU utilization was really high (above 90%) without any fluctuation. After checking ......

ASP.net页面跳转方式三种

 
asp.net在开发时,在不同的页面间跳转是我们常遇到的一件事,当一个复杂的逻辑在一个页面放不下分成二个或多个页面处理就需要在页面间跳转,用的最多还是用户的登陆吧.
ASP.NET用的最多的跳转是Response.Redirect,这个命令可以直接把请求重定向到一个相对或绝对的路径.它会把当前页面的的Http流阻断直接重定向到新的U ......

asp.net网页播放器

之前要完成一个支持多支持多种格式的视频播放器,在网上找到一个VB写的,然后改成C#,近段在网上也见有不少人问这个问,在此分享
public class VideoPlayer
    {
        /// <summary>
        /// 生成视频播放器的HTM ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号