| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 726 人关注过本帖
标题:求救啊~!!!!
只看楼主 加入收藏
cinderella0
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-8-29
收藏
 问题点数:0 回复次数:5 
求救啊~!!!!
我的代码那错了啊。。。。。
       CollectSelected();

        this.TextBox6.Text = string.Empty;
        foreach (object tmp in this.SelectedItems)
            this.TextBox6.Text += tmp.ToString() + ",";
        string a = this.TextBox6.Text;        
        a = a.TrimEnd(',');
        SqlConnection con = new SqlConnection("server=localhost;database=User;user=grid;password=grid");
        con.Open();
        SqlCommand com = new SqlCommand("(update Message set huiyuanjiezhishijian='" + this.Text1.Value + "' where ID in('" + a +"'))", con);
        SqlDataAdapter da = new SqlDataAdapter(com);
        DataSet ds = new DataSet();
        Response.Write(a+"-----------------");
        con.Close();
为什么数据没有更新啊。。。。。。。
搜索更多相关主题的帖子: localhost password database server update 
2008-09-27 15:43
kevintang
Rank: 4
等 级:业余侠客
威 望:9
帖 子:799
专家分:236
注 册:2008-2-14
收藏
得分:0 
CollectSelected();

        this.TextBox6.Text = string.Empty;
        foreach (object tmp in this.SelectedItems)
            this.TextBox6.Text += tmp.ToString() + ",";
        string a = this.TextBox6.Text;        
        a = a.TrimEnd(',');
        SqlConnection con = new SqlConnection("server=localhost;database=User;user=grid;password=grid");
        con.Open();
        SqlCommand com = new SqlCommand("update Message set huiyuanjiezhishijian='" + this.Text1.Value + "' where ID ='" + a +"'", con);
        SqlDataAdapter da = new SqlDataAdapter(com);
        DataSet ds = new DataSet();
        Response.Write(a+"-----------------");
        con.Close();

编程少年基地——少年编程者的练兵场
http://bcsn.    招聘版主中

2008-09-27 15:57
cinderella0
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-8-29
收藏
得分:0 
不行啊,还是不行。。。。。。。。数据更新不进去。。。。。。。。
2008-09-27 16:09
cinderella0
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-8-29
收藏
得分:0 
我的ID是字符串。不能那么写的,只能用where id in()这个形式。。。。
2008-09-27 16:10
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 
把语句输出来到数据库中去执行一下看可以不

飘过~~
2008-09-27 17:16
仰望星空
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:7
帖 子:473
专家分:93
注 册:2007-2-11
收藏
得分:0 
SqlCommand com = new SqlCommand("update Message set huiyuanjiezhishijian='" + this.Text1.Value + "' where ID ='" + a +"'", con);
完了呢?
com不需要再调用个ExecuteNonQuery()方法执行一下吗?


SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
这两句做什么的?好像没用吧

当人们仰望天空的时候,才有了翱翔的愿望;当人们仰望星空的时候,才有了远航的渴望。
2008-09-27 21:14
快速回复:求救啊~!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027809 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved