<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>富创业务交货计划</title>
    <style type="text/css">
    body
{
margin: 0px;
width: 100%;
height: 100%;
}
    .BackGroundimage
{
margin: 0px;
width: 100%;
height: 100%;
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/login_di.jpg', sizingMethod='scale'); 
}
   .menu
{
margin: 0px;
width: 100%;
height: 100%;
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/menubar_bg.gif', sizingMethod='scale'); 
}
    </style>
    <style type="text/css">
    .altRow { background-color: #ddddff; }
    </style>
    <link href="superTables.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="jquery-1.3.1.js"></script>
    <script type="text/javascript" src="superTables.js"></script>
    <script type="text/javascript" src="jquery.superTable.js"></script>
    <script type="text/javascript">
        $(function() {
            $("#GridView1").toSuperTable({ width: "975px", height: "500px", fixedCols: 8})
            .find("tr:even").addClass("altRow");
        });
    </script>
     <script type="text/javascript">
        $(function() {
            $("#GridView2").toSuperTable({ width: "975px", height: "500px", fixedCols: 9})
            .find("tr:even").addClass("altRow");
        });
    </script>
    
</head>
<body >
    <form id="form1" runat="server">
    <div runat="server" style="height:600px; z-index:0;" class="BackGroundimage">
        <div style="height:30px;top:5px; width:100%; position:absolute;text-align:center;">
            <asp:Label ID="page_name" runat="server"></asp:Label>
        </div>
        <div style="height:30px;top:40px; width:100%; position:absolute;text-align:center;line-height:30px; left: 0px;" class="menu">
            <table style="width: 75%; height: 100%">
                <tr>
                    <td style="width: 40px">
                    <asp:Label ID="user" runat="server"></asp:Label>
                    </td>
                    <td style="width: 50px">
                    <asp:TextBox ID="user_text" runat="server" style="width:50px"></asp:TextBox>
                    <asp:Label ID="user_login" runat="server" style="width:50px"></asp:Label>
                    </td>
                    <td style="width: 30px">
                    <asp:Label ID="password" runat="server"></asp:Label>
                    </td>
                    <td style="width: 50px">
                    <asp:TextBox ID="password_text" runat="server" style="width:50px"></asp:TextBox>
                    </td>
                    <td style="width: 70px">
                    <asp:ImageButton ID="login" runat="server" OnClick="login_Click" />
                    </td>
                    <td style="width: 40px;text-align:right;">
                    <asp:Label ID="Department" runat="server"></asp:Label>
                    </td>
                    <td style="width: 70px;text-align:left;">
                    <asp:DropDownList ID="Department_list" runat="server"></asp:DropDownList>
                    </td>
                    <td style="width: 70px">
                    <asp:ImageButton ID="yw_jhpc" runat="server" OnClick="yw_jhpc_Click" />
                    </td>
                    <td style="width: 70px">
                    <asp:ImageButton ID="sg_jhpc" runat="server" OnClick="sg_jhpc_Click" />
                    </td>
                     <td style="width: 70px">
                    <asp:ImageButton ID="jhpc" runat="server" />
                    </td>
                     <td style="width: 70px">
                    <asp:ImageButton ID="history" runat="server" />
                    </td>
                </tr>
            </table>
        </div>
        <div style="top:70px;position:absolute;" id="c1" runat="server">
        <asp:GridView ID="GridView1"  AllowSorting="true" runat="server"   Font-Size="10pt" AutoGenerateEditButton="True" AutoGenerateColumns="False" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnSorting="GridView1_Sorting" OnRowUpdating="GridView1_RowUpdating"  OnRowDataBound="GridView1_RowDataBound" >
            <Columns>
                <asp:BoundField DataField="订单号" HeaderText="订单号" ReadOnly="True" />
                <asp:BoundField DataField="kf_name" HeaderText="客户名称" ReadOnly="True" SortExpression="kf_name"/>
                <asp:BoundField DataField="FShortNumber" HeaderText="物料代码" ReadOnly="True" SortExpression="FShortNumber" />
                <asp:BoundField DataField="fname" HeaderText="规格型号" ReadOnly="True" />
                <asp:BoundField DataField="数量" HeaderText="订单量" ReadOnly="True" DataFormatString="{0:0}" HtmlEncode="False"/>
                <asp:BoundField DataField="Qty" HeaderText="已交量" ReadOnly="True" DataFormatString="{0:0}" HtmlEncode="False"/>
                <asp:BoundField DataField="FQty" HeaderText="未交量" ReadOnly="True" DataFormatString="{0:0}" HtmlEncode="False"/>
                <asp:BoundField DataField="emp1" HeaderText="业务" ReadOnly="True" >
                <ItemStyle Width="50px" />                
                </asp:BoundField>
                <asp:BoundField DataField="cp" HeaderText="重" ReadOnly="True" />
                <asp:BoundField DataField="f1" ReadOnly="True"  />
                <asp:BoundField DataField="f2" ReadOnly="True"  />
                <asp:BoundField DataField="f3" >
                    <ControlStyle Width="45px" />
                    <ItemStyle HorizontalAlign="Center" />                
                </asp:BoundField>
                <asp:BoundField DataField="f4"  >
                    <ControlStyle Width="45px" />
                    <ItemStyle HorizontalAlign="Center" />                
    
            </Columns>
        </asp:GridView>
        </div>后
protected void GridView1_RowUpdating(object sender,GridViewUpdateEventArgs e)
    {
            string sqldb = System.Configuration.ConfigurationManager.ConnectionStrings["jhpcsql"].ConnectionString;
            SqlConnection con = new SqlConnection(sqldb);
            string f3 = (GridView1.Rows[e.RowIndex].Cells[12].Controls[0] as TextBox).Text.Trim();

解决方案 »

  1.   

     string sqlstr = "update t_jhpc set f3='"+ f3 +"',f4='" + f4 +"',f5='" + f5 +"',f6='" + f6 +"',f7='" + f7 +"',f8='" + f8 +"',f9='" + f9 + "',f10='" + f10 + "',f11='" + f11 + "',f12='" + f12 + "',f13='" + f13 +"',f14='" + f14 + "',f15='" + f15 +"',f16='" + f16 +"',f17='" + f17 + "',f18='" + f18 + "',f19='" + f19 + "',f20='" + f20 +"',f21='" + f21 +"',f22='" + f22 +"',f23='" + f23 +"',f24='" + f24 +"',f25='" + f25 +"',f26='" + f26 +"',f27='" + f27 +"',f28='" + f28 +"',f29='" + f29 +"',f30='" + f30 +"',Fcheck=0,emp2='" + this.user_login.Text.ToString().Trim() + "' where id='"
                + this.GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
    我输出到标签就有个,号
      

  2.   

    SQL静态测试没问题,好像从gridview取出值就是有问题!
      

  3.   


    protected void GridView1_RowUpdating(object sender,GridViewUpdateEventArgs e)
        {
                string sqldb = System.Configuration.ConfigurationManager.ConnectionStrings["jhpcsql"].ConnectionString;
                SqlConnection con = new SqlConnection(sqldb);
                string f3 = (GridView1.Rows[e.RowIndex].Cells[12].Controls[0].Controls[0] as TextBox)).Text.ToString().Trim() as TextBox;
                string f4 = GridView1.Rows[e.RowIndex].Cells[13].Text.ToString().Trim();
                string f5 = GridView1.Rows[e.RowIndex].Cells[14].Text.ToString().Trim();
                string f6 = GridView1.Rows[e.RowIndex].Cells[15].Text.ToString().Trim();
                string f7 = GridView1.Rows[e.RowIndex].Cells[16].Text.ToString().Trim();
                string f8 = GridView1.Rows[e.RowIndex].Cells[17].Text.ToString().Trim();
                string f9 = GridView1.Rows[e.RowIndex].Cells[18].Text.ToString().Trim();
                string f10 = GridView1.Rows[e.RowIndex].Cells[19].Text.ToString().Trim();
                string f11 = GridView1.Rows[e.RowIndex].Cells[20].Text.ToString().Trim();
                string f12 = GridView1.Rows[e.RowIndex].Cells[21].Text.ToString().Trim();
                string f13 = GridView1.Rows[e.RowIndex].Cells[22].Text.ToString().Trim();
                string f14 = GridView1.Rows[e.RowIndex].Cells[23].Text.ToString().Trim();
                string f15 = GridView1.Rows[e.RowIndex].Cells[24].Text.ToString().Trim();
                string f16 = GridView1.Rows[e.RowIndex].Cells[25].Text.ToString().Trim();
                string f17 = GridView1.Rows[e.RowIndex].Cells[26].Text.ToString().Trim();
                string f18 = GridView1.Rows[e.RowIndex].Cells[27].Text.ToString().Trim();
                string f19 = GridView1.Rows[e.RowIndex].Cells[28].Text.ToString().Trim();
                string f20 = GridView1.Rows[e.RowIndex].Cells[29].Text.ToString().Trim();
                string f21 = GridView1.Rows[e.RowIndex].Cells[30].Text.ToString().Trim();
                string f22 = GridView1.Rows[e.RowIndex].Cells[31].Text.ToString().Trim();
                string f23 = GridView1.Rows[e.RowIndex].Cells[32].Text.ToString().Trim();
                string f24 = GridView1.Rows[e.RowIndex].Cells[33].Text.ToString().Trim();
                string f25 = GridView1.Rows[e.RowIndex].Cells[34].Text.ToString().Trim();
                string f26 = GridView1.Rows[e.RowIndex].Cells[35].Text.ToString().Trim();
                string f27 = GridView1.Rows[e.RowIndex].Cells[36].Text.ToString().Trim();
                string f28 = GridView1.Rows[e.RowIndex].Cells[37].Text.ToString().Trim();
                string f29 = GridView1.Rows[e.RowIndex].Cells[38].Text.ToString().Trim();
                string f30 = GridView1.Rows[e.RowIndex].Cells[39].Text.ToString().Trim();
                this.page_name.Text = f3;
                string sqlstr = "update t_jhpc set f3='"+ f3 +"',f4='" + f4 +"',f5='" + f5 +"',f6='" + f6 +"',f7='" + f7 +"',f8='" + f8 +"',f9='" + f9 + "',f10='" + f10 + "',f11='" + f11 + "',f12='" + f12 + "',f13='" + f13 +"',f14='" + f14 + "',f15='" + f15 +"',f16='" + f16 +"',f17='" + f17 + "',f18='" + f18 + "',f19='" + f19 + "',f20='" + f20 +"',f21='" + f21 +"',f22='" + f22 +"',f23='" + f23 +"',f24='" + f24 +"',f25='" + f25 +"',f26='" + f26 +"',f27='" + f27 +"',f28='" + f28 +"',f29='" + f29 +"',f30='" + f30 +"',Fcheck=0,emp2='" + this.user_login.Text.ToString().Trim() + "' where id='"
                + this.GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
                string log = "insert into jhpc_log (fid,fname,fdate,action,re) select a.id,b.fname,getdate(),'业务排程','下单日期'+CONVERT(varchar(10),a.日期,120) from t_jhpc a,stras_user b where b.fname='" + this.user_login.Text.ToString() + "' and a.id=" + this.GridView1.DataKeys[e.RowIndex].Value.ToString();
                SqlCommand sqlcom = new SqlCommand(sqlstr, con);
                SqlCommand logcom = new SqlCommand(log, con);
                con.Open();
                sqlcom.ExecuteNonQuery();
                logcom.ExecuteNonQuery();
                con.Close();
                this.GridView1.EditIndex = -1;
                band_yw_jhpc();
              
                    
        }
      

  4.   

    我也感觉是SQL语句的错误导致的有逗号..
      

  5.   

    你把最后程序实行的SQL输出出来,自己分析吧。 或者自己设断点调试业务程序看得头大。
      

  6.   

    SQL拼接很容易出问题的,特别是有脏数据或者不安全因素 。建议用 SqlParameter 做吧。
      

  7.   

    this.page_name.Text = f3;
    这一条语句输出到页面控件时,就有,号
      

  8.   

    用DeBug看下,你取出的数据,里面是否存在“,”。
    如果有,就看下那个字段。在把你的SQL文,给DeBug出来看看!!那里有错!
      

  9.   

    问题解决。代码是:
    在点编辑时就清空行数据:
      protected void GridView1_RowEditing(object sender,GridViewEditEventArgs e)
        {
            this.GridView1.EditIndex = e.NewEditIndex;
            band_yw_jhpc();
            (this.GridView1.Rows[e.NewEditIndex].Cells[12].Controls[0] as TextBox).Text = "";
            (this.GridView1.Rows[e.NewEditIndex].Cells[13].Controls[0] as TextBox).Text = "";
    在保存时,取字符长度1以后的数据  string sqldb = System.Configuration.ConfigurationManager.ConnectionStrings["jhpcsql"].ConnectionString;
                SqlConnection con = new SqlConnection(sqldb);
                string f3 = (GridView1.Rows[e.RowIndex].Cells[12].Controls[0] as TextBox).Text.ToString().Trim().Substring(1);这样基本OK了!
      

  10.   

    兄弟。解决了吗。好像是那个冻结列和行的问题。你把  <script type="text/javascript">
      $(function() {
      $("#GridView1").toSuperTable({ width: "975px", height: "500px", fixedCols: 8})
      .find("tr:even").addClass("altRow");
      });
      </script>
      <script type="text/javascript">
      $(function() {
      $("#GridView2").toSuperTable({ width: "975px", height: "500px", fixedCols: 9})
      .find("tr:even").addClass("altRow");
      });
      </script>注释掉试试。不知道要怎么解决。正在弄
      

  11.   

    model.mqgs = ((TextBox)GridView1.Rows[i].FindControl("mqgs")).Text.Substring(model.mqgs.Length + 1);
    我的更新代码。你参考下更新时得到的值是原来+更新时
    如原来“男人”
    更改为“女人”我们后台取得“男人,女人”我们只要去掉原来的值就可以了。