<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="editTab">
  <tr>
  <td>
  <asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False" OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing" DataSourceID="SqlDataSource1" >
  <Columns>
  <asp:BoundField HeaderText="单位" DataField="bName" />
  <asp:CommandField HeaderText="编辑" ShowEditButton="True" />
  <asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
  </Columns>
  <FooterStyle Width="100%" Wrap="False" />
  </asp:GridView>
  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=<%=server%>;Initial Catalog=<%=Database%>;User ID=<%=vUser%>;Password=<%=Password%>"
  ProviderName="System.Data.SqlClient"
  SelectCommand="SELECT * FROM [Tb_Branch] WHERE ([bParentBranch] = @bParentBranch)" OldValuesParameterFormatString="original_{0}"
  UpdateCommand=" " DeleteCommand=" ">
  <SelectParameters>
  <asp:Parameter DefaultValue="0" Name="bParentBranch" Type="String" />
  </SelectParameters>
  </asp:SqlDataSource>
  </td>
  </tr>
  </table>前台读取配置文件;
if (File.Exists(strFilePath))//读取时先要判读INI文件是否存在   
  {
  strSec = "Database";
  server = ContentValue(strSec, "Server");
  Database = ContentValue(strSec, "Database");
  vUser = ContentValue(strSec, "User");
  Password = ContentValue(strSec, "Password");
  }
运行时出错:“/用户”应用程序中的服务器错误。
--------------------------------------------------------------------------------在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)