runxinzhi.com
首页
百度搜索
随手记录修改某条记录时,不使用数据库控件而用datareader
可能是很简单的,记录一下,以后自己好用
protected
void
Page_Load(
object
sender, EventArgs e)
{
getSession.JuageSession();
//
自定义的一个检查登录状态的类
if
(
!
Page.IsPostBack)
{
int
id
=
Convert.ToInt32(Request[
"
id
"
]);
this
.ViewState[
"
id
"
]
=
id;
string
sqlexe
=
"
select * from product where id =
"
+
id;
SQLDbDataReader dr
=
userSql.db.ExecuteDataReader(sqlexe);
if
(dr.Read())
{
this
.title.Text
=
dr[
"
title
"
].ToString();
this
.content.Value
=
dr[
"
content
"
].ToString();
DropBind(Convert.ToInt32(dr[
"
parent
"
]));
this
.ViewState[
"
smallimg
"
]
=
dr[
"
smallimg
"
];
this
.ViewState[
"
bigimg
"
]
=
dr[
"
bigimg
"
];
this
.ViewState[
"
id
"
]
=
dr[
"
id
"
];
this
.audit.Checked
=
Convert.ToBoolean(dr[
"
audit
"
]);
this
.post.Text
=
dr[
"
post
"
].ToString();
this
.comment.Text
=
dr[
"
comment
"
].ToString();
}
dr.Close();
dr.Dispose();
dr
=
null
;
PageControlInt();
}
}
相关阅读:
shell入门-cut命令
shell入门-特殊符号
shell入门-系统和用户的配置文件
shell入门-变量
shell入门-shell特性
linux命令-yum工具详解
linux命令-rpm查询包
linux命令-rpm安装和卸载
math 数学模块
random 随机模块
原文地址:https://www.cnblogs.com/yeagen/p/1331190.html
最新文章
开学测试报告
假期周进度报告八(8.19-8.25)
假期周进度报告七(8.12-8.18)
假期周进度报告六(8.5-8.11)
假期周进度报告五(7.29.-8.4)
阅《大道至简--软件工程实践者的思想》有感
假期周进度报告四(7.22-7.28)
假期周进度报告三(7.15-7.21)
使用ListView控件展示数据
《坚毅》的读后感
热门文章
winform通过ListView绑定数据库数据源
winfrom实现简单计算器V2版本
构建布局良好的Windows程序
winform实现简单的计算器V1版本
初识Windows程序
sqlserver存储过程
记录程序人生
事务、视图和索引
shell入门-wc
shell入门-sort排序
Copyright © 2020-2023
润新知