ASP.NET DBHelper类
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Data.Common;
using System.Data;
namespace DownData.dal
{
public static class DBHelper
{
private static readonly string connectionString =
"Data Source=.\\newdb;Initial Catalog=downloaddata; uid=sa;pwd=sa";
private static readonly string providerName ="System.Data.SqlClient";
//GetConnection 用于获取连接数据库的 connection 对象...
private static DbConnection GetConnection()
{
DbProviderFactory _factory = DbProviderFactories.GetFactory(providerName);
DbConnection connection = _factory.CreateConnection();
connection.ConnectionString = connectionString;
return connection;
}
//GetCommand 获取命令参数 command 对象...
private static DbCommand GetCommand(string commandText, CommandType commandType, DbConnection connection)
{
DbCommand command = connection.CreateCommand();
command.CommandText = commandText;
command.CommandType = commandType;
 
相关文档:
一、认识Web.config文件
Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的
Web.config文件,包括默认的配置设置 ......
先看看ASP.NET页面刷新的实现方法:
第一:
C# code
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
第二:
C# code
private void Button2_Click( object sender, System.EventArgs e )
{
Response.Write( " < script lang ......
最近开发中在页面之间传递值的过程中,多处应用了超链接传值的方式。但是当传递的参数中含有中文字符时,在调用Request.QueryString[]方法接收参数时,总是出现错误,而且错误的出现总是随机的。表现为接收的中文参数不全,后加通配符“?”,或者把中文参数后的那个参数和中文参数混在一起,不加区分。
& ......
这里是我的一个简单的jquery+json的连库操作,只是一个简单查询,
//后台代码
<%@ WebHandler Language="C#" Class="show" %>
using System;
using System.Web;
using System.Collections.Generic;
using Model;
using DAL;
using System.Web.Script.Serialization;
public class show ......
开发中经常遇到要重置控件值得操作,下面写了常用HTML控件的重置方法。不完整的,大家可以扩充
function ResetControl() {
var v = document.forms[0].elements;
for (var i = ......