易截截图软件、单文件、免安装、纯绿色、仅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导出Excel乱码的解决方案

在asp.net中导出excel 中比较通行的做法是: Response.ContentType = "application/vnd.ms-excel";
然后直接向里面扔 html 的table
但是有中文的时候 老出现乱码,有很多解决方案,但都不能通盘解决, 就是在 输出html两头输出
 
Response.Write("<html><head><meta http-equiv=Content-Type conte ......

[分享]ASP.net一个空间多个网站的设置

看到有人提问一个空间支持多个网站的问题。
总结一下:
最好保证各个项目app_code内的文件都是一样的。
因为生成多个项目必定生成多个App_Code.dll,
由于所有dll放在同一个bin目录,所以要保证app_code内的文件一样。
发布前所有项目aspx文件的 Inherits="menulefttb" 中的名字不能相同。
将每个项目发布后生成的dll ......

asp.net教程:WPF图形系统

  在Windows NT中,图形多媒体系统基于层次结构。应用程序与顶层的API(实际上是多个用户模式的系统DLL,比如GDI32.DLL)交互,这些系统DLL最终会通过系统服务调用处于内核模式的系统服务。
NT系统的详细信息可参考《Windows 图形编程》的第一、二章。在Windows Vista中,图形系统已经移出了内核模式,并有自己的空间 ......

ASP.NET 檔案下載

//TransmitFile实现下载
    protected void Button1_Click(object sender, EventArgs e)
    {
        /*
        微软为Response对象提供了一个新的方法TransmitFile来解决使用Respo ......

使用ASP.NET 2.0 Profile存储用户信息[翻译]

作者: Stephen Walther
原文地址:http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnvs05/html/UserProfiles.asp

者:Tony Qu
概要:许多ASP.NET应用程序需要跨访问的用户属性
跟踪功能,在ASP.NET1.1中,我们只能人工实现这一功能。但如今,使用 ASP.NET 2.0的Profile对象,这个过程变得异 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号