| 您的当前位置:我要购书网>在线阅读>ASP/PHP/.NET/XML |
jscript.net 之 sqldatareader读取数据
来源:互联网 作者: 发布:我要购物网收集整理 发布时间:2006-8-31 人气:161 |
<%@import namespace="System.Data.SqlClient"%>
var db : String = "server=10.1.0.1;uid=sa;pwd=123;database=db"; var sql : String = " select * from table ";
var rs = SqlDataReader; var conn : SqlConnection = new SqlConnection(db); var cmd : SqlCommand = new SqlCommand(sql,conn); try{
conn.Open(); rs = cmd.ExecuteReader(); if (rs.HasRows){ //Founded. }else{ //Not Found. while(rs.Read()){ Response.Write(rs["id"] .ToString()); } } rs.Close(); conn.Close(); }catch(e){ Response.Write("ERROR!");}finally{ cmd.Dispose(); conn.Dispose();}%> |
|
| 相关文章 |
 |
|
|
| 热点文章 |
 |
|
|