社区
C#
帖子详情
关于GridView的增删改
a47305816
2009-01-20 09:15:06
我想在GridView填加增删改
查询已经完成了
请高手赐教
...全文
134
12
打赏
收藏
关于GridView的增删改
我想在GridView填加增删改 查询已经完成了 请高手赐教
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
12 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
a47305816
2009-01-20
打赏
举报
回复
不知道改搜什么字
搜出来的都不是想要的
suners
2009-01-20
打赏
举报
回复
数据库操作了搜网上的友好多例子
a47305816
2009-01-20
打赏
举报
回复
要改哪个属性?
在数据库那改的?
还是在事件那改的
a47305816
2009-01-20
打赏
举报
回复
谁教下QQ233168121
或者发QQ我加下~
j45kp
2009-01-20
打赏
举报
回复
protected void profileGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
profileGridView.PageIndex = e.NewPageIndex;
gvBind();
}
protected void profileGridView_RowEditing(object sender, GridViewEditEventArgs e)
{
profileGridView.EditIndex = e.NewEditIndex;
gvBind();
}
protected void profileGridView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
profileGridView.EditIndex = -1;
gvBind();
}
protected void profileGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string destination = ((TextBox)profileGridView.Rows[e.RowIndex].Cells[0].Controls[0]).Text;
string ship = ((TextBox)profileGridView.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
string myStr = 连接语句
string SqlStr = "update 语句
try
{
OleDbConnection conn = new OleDbConnection(myStr);
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn;
cmd.CommandText = SqlStr;
cmd.CommandType = CommandType.Text;
cmd.CommandTimeout = 10;
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
int i = cmd.ExecuteNonQuery();
//if (conn.State == ConnectionState.Open)
conn.Close();
profileGridView.EditIndex = -1;
gvBind();
}
catch (Exception ex)
{
Response.Write("数据库错误,错误原因:" + ex.Message);
Response.End();
}
}
protected void profileGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
DeleteAdminInfo(itemId);
gvBind();
}
public void DeleteAdminInfo(string itemId)
{
string myStr = 链接字符
OleDbConnection conn = new OleDbConnection(myStr);
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn;
cmd.CommandText = delete 语句
cmd.CommandType = CommandType.Text;
//添加参数
OleDbParameter id = new OleDbParameter(":profile_id", OleDbType.Char, 36);
id.Value = itemId;
cmd.Parameters.Add(id);
//执行过程
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
llsen
2009-01-20
打赏
举报
回复
winform
or
web
的?
gtiroy
2009-01-20
打赏
举报
回复
[Quote=引用 5 楼 gtiroy 的回复:]
你看看 天弘穿 的视频就行了
[/Quote]
鼠标简单点两下就行了。
gtiroy
2009-01-20
打赏
举报
回复
你看看 天弘穿 的视频就行了
xiaoyanwei2000
2009-01-20
打赏
举报
回复
删除修改在gridview 的属性中就可以设置allowedit,allowdelete添加你就要操作数据元了
zjybushiren88888
2009-01-20
打赏
举报
回复
[Quote=引用 2 楼 zgke 的回复:]
GridView 你修改 添加 删除 都在数据源里操作,..
[/Quote]
同意
zgke
2009-01-20
打赏
举报
回复
GridView 你修改 添加 删除 都在数据源里操作,..
a47305816
2009-01-20
打赏
举报
回复
我用的是Microsoft Visual Studio 2005
新手,发发代码
[初学者学习用]
gridview
增删
改
.rar
初学者学习用]
gridview
增删
改
GridView
增删
改
查学习示例源码
我只会
增删
改
查啊~~ 肿么办.
gridview
增删
改
操作
gridview
各种操作,相信你一定会喜欢的。
ASPx
GridView
增、删、
改
操作
ASPx
GridView
常规操作,包括数据的增加,删除,修
改
。
GridView
增除删
改
该文件主要包含了
gridview
控件的
增删
改
查的功能,是学习
gridview
控件的理想范例。
C#
110,534
社区成员
642,575
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章