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

asp.net从sql server2005中查询数据

 首先要添加
using System.Data;
using System.Data.SqlClient;    
接下来:
          SqlConnection conn = new SqlConnection("server=QLPC\\SQL2005;uid=sa;pwd=(你的密码);database=(你的数据表)");                  //用于连接数据库
            conn.Open();       //打开数据库
            SqlCommand cmd = new SqlCommand("select * from [user]", conn);              //相当于执行数据语句吧
            SqlDataReader read = cmd.ExecuteReader();                                   //创建一个SqlDataReader的read象  
            while (read.Read())                                                  //当读取的数据存在时则写出来
            {
                Response.Write(read[0]);
            }
conn.close();                //关闭数据库的链接


相关文档:

SQL数据库还原语句

---附加数据库
sp_attach_db   '数据库名','数据库全路径','数据库日志全路径'
---查看数据库逻辑文件名
RESTORE FILELISTONLY from disk = '备份文件'
---还原数据库
restore database hzrb from disk = '备份文件'
with move '主逻辑名'     to '存放mdf路径'    ......

sql 修改列名及表名

代码如下:
EXEC sp_rename '表名.[原列名]', '新列名', 'column'
*************************************************************************
Transact-SQL 参考
sp_rename
更改当前数据库中用户创建对象(如表、列或用户定义数据类型)的名称。
示例
A. 重命名表
下例将表 customers 重命名为 custs。 ......

SQL Server 经常用到的几个设置选项

1. SET DEADLOCK_PRIORITY
说明:控制在发生死锁情况时会话的反应方式。如果两个进程都锁定数据,并且直到其它进程释放自己的锁时,每个进程才能释放自己的锁,即发生死锁情况。
语法:SET DEADLOCK_PRIORITY { LOW | NORMAL | @deadlock_var }
参数:LOW   ......

asp.net日志

                    string path = "...\\Debug\\log.txt";
                    if (!File.Exists(path))
 & ......

ASP.NET(c#)常用类函数

 
常用函数系列:
public static string Get_ClientIP() 得到客户端IP
public static string Get_CMac(string IP) 得到客户端 CMac 地址
public static string RequestF(string xPName,string xPType,int xLenDef) 安全接收数据系列
public static string Show_Cont(string xStr) 过滤显示字串
public static str ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号