标题:Asp.net站内短消息 添加电话本明细 求教!
取消只看楼主
chairmancui
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2007-7-10
 问题点数:0 回复次数:1 
Asp.net站内短消息 添加电话本明细 求教!
添加地址本的同时  也要添加一个地址本明细  点添加后地址本添加成功 可是明细添加不进去  不知道为什么?
protected void Button1_Click(object sender, EventArgs e)
    {
        DataTable table = (DataTable)(Session["userTable"]);
        int OwnerUserId=Int32.Parse(table.Rows[0][0].ToString());
        string AddressBookName=AddressBookName1.Text.Trim();
        string Remark = AddressRemark1.Text.Trim();
        int Addaddressbook = abs.InsertAddressBook(OwnerUserId,AddressBookName,Remark);
        try
        {
            int AddressBookId = abd.SelectAddressBookId(AddressBookName);
            //Response.Write("<script>alert('" + AddressBookId + "')</script>");

            for (int i = 0; i < AddressBookDataGrid.Items.Count; i++)
            {
                if (((CheckBox)AddressBookDataGrid.Items[i].FindControl("CheckBox1")).Checked == true)
                {
                    int ContactorId = Int32.Parse(((Label)(AddressBookDataGrid.Items[i].FindControl("Label"))).Text.Trim());*******单步运行到这里 ContactorId =0了 然后直接进catch了报异常 ContactorId 接收方法不对吗?System.FormatException: 输入字符串的格式不正确
                    abd.InsertAddressBookDetail(AddressBookId, ContactorId);
                }
            }
        }
        catch (Exception eee)
        {
            Response.Write(eee);
        }
    }

这是添加类的方法
    public int InsertAddressBookDetail(int AddressBookId, int ContactorId)
    {
        string sql = "insert into AddressBookDetail values(" + AddressBookId + "," + ContactorId + ")";
        return dbo.Excute(sql);
    }

[[it] 本帖最后由 chairmancui 于 2008-3-30 15:15 编辑 [/it]]
搜索更多相关主题的帖子: 短消息 Asp 电话 
2008-03-30 15:11
chairmancui
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2007-7-10
得分:0 
没错啊 复制的
2008-03-30 20:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-206178-1-1.html




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

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