asp.net数据库操作类(存储过程处理)
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.ComponentModel;
namespace SQLHelper
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class SQLHelper
{
// 连接数据源
private SqlConnection myConnection;
private readonly string RETURNVALUE = "RETURNVALUE";
/// <summary>
/// 打开数据库连接.
/// </summary>
private void Open()
{
// 打开数据库连接
if (myConnection == null)
{
myConnection = new SqlConnection(ConfigurationSettings.AppSettings["SQLCONNECTIONSTRING"].ToString());
}
if(myConnection.State == ConnectionState.Closed)
{
try
{
///打开数据库连接
myConnection.Open();
}
catch(Exception ex)
{
SystemError.SystemLog(ex.Message);
}
finally
{
///关闭已经打开的数据库连接
}
}
}
/// <summary>
/// 关闭数据库连接
/// </summary>
public void Close()
{
///判断连接是否已经创建
if(myConnection != null)
{
///判断连接的状态是否打开
if(myConnection.State == ConnectionState.Open)
{
myConnection.Close();
&
相关文档:
Asp.Net Forms验证(自定义、角色提供程序、单点登录)
以前开发项目时经常是自己开发一套用户权限管理系统进行验证,比较灵活。最近为了单点登录的问题又把Asp.Net自带的验证方式看了一遍,发现这种方式也比较方便,功能也还可以。在Asp.Net提供了三种常用的验证方式:Windows方式是和IIS结合起来可以实现基本、摘要、集成 ......
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.Specialized;
4 using System.Linq;
5 using System.Web;
6 using System.Text;
7 u ......
一.后台调用前台
1.Page.ClientScript.RegisterStartupScript(type,"",script);
例:
string script = string.Format("<script>alert('Wrong');</script>");
Page.ClientScript.RegisterStartupScript(GetType(), "Load", script);
2.对象.Attributes.Add("事件","script")
例:
e.Row.Attributes.Add("on ......
asp.net发布网站时三个选项的问题
发布网站的时候有三个选项:
第一个选项指定发布后是不是可以修改aspx文件,如果勾选,则发布后的网站行为基本与ASP.NET 1.1一致,只要没有增删修改控件,可以直接在服务器上修改aspx文件不用重新发布网站。
第二个选项指定是不是将每个aspx文件都编 ......