帮定代码:
private void BindGrid()
    {
        string sql;
        db rs = new db();
        sql = "select id,name,resume,photoPath from GE_Photo where proj_id='21'";
        da = rs.getda(sql);
        da.Fill(ds, "GE_Photo1");
        list.DataSource = ds.Tables[0];
        list.DataBind();
    }
联数据库的CLASS
public class db
{
//
// TODO: 在此处添加构造函数逻辑
//
        public System.Data.SqlClient.SqlConnection conn;
        public string sqlSet = ConfigurationManager.AppSettings["dsn"];
public db()
{
conn=new SqlConnection(sqlSet);
}
        public SqlDataAdapter getda(string sql)
        {
            System.Data.SqlClient.SqlDataAdapter da = new SqlDataAdapter(sql, conn);
            return da;
        }
public DataSet getrs(string sql)
{
System.Data.SqlClient.SqlDataAdapter da=new SqlDataAdapter(sql,conn);
System.Data.DataSet ds=new DataSet();
            da.Fill(ds, "table");
return ds;
}


更新:
da.Update(ds, "GE_Photo1");
ASPX页面代码:
<asp:repeater  id ="list" runat ="server">
                                <itemtemplate>
<table width="800"  border="0" cellpadding="1" cellspacing="1">
                                  <tr>
                                    <td rowspan="3" style="width: 139px; height: 164px" ><asp:Image ID="Image1" runat="server" Height="154px" Width="220px" ImageUrl='<%# GetPhotoPath(((DataRowView)Container.DataItem)["photoPath"].ToString()) %>' /></td>
                                    <td style="width: 67px; height: 23px" ><asp:Label ID="Label1" runat="server" Text="图片名称:"></asp:Label></td>
                                    <td style="height: 23px" >
                                        <asp:TextBox ID="TextBox1" runat="server" CssClass="TextCss" Width="261px" Text='<%# ((DataRowView)Container.DataItem)["name"].ToString() %>'></asp:TextBox><input id="photo_id" type="hidden"  runat="server" value='<%# ((DataRowView)Container.DataItem)["id"].ToString() %>' /></td>
                                  </tr>
                                  <tr>
                                      <td style="width: 67px; height: 137px" ><asp:Label ID="Label2" runat="server" Text="图片说明:"></asp:Label>&nbsp;</td>
                                    <td style="height: 137px" >
                                        <asp:TextBox ID="TextBox2" runat="server" Height="122px" TextMode="MultiLine" Width="267px" Text='<%# ((DataRowView)Container.DataItem)["resume"].ToString() %>'></asp:TextBox></td>
                                  </tr>
                                  <tr>
                                  </tr>
                                </table>
                                </itemtemplate>
                                </asp:repeater>
我一次要对所有图片的名称和说明进行更新,不知我这方法行不行,为什么我更新时数据库没有反映,那出问题了