feat: fmBprm GridView 改用 ObjectDataSource

- BprmDAC 新增 SelectPage/SelectCount

- dsBPRMGrid 改 ObjectDataSource;dsBPRM_Selected 拆分為 grid/form
This commit is contained in:
2026-09-10 10:43:56 +08:00
parent 10f73526bc
commit dd8a26206f
4 changed files with 74 additions and 19 deletions
+7 -6
View File
@@ -80,12 +80,13 @@
</table>
</asp:View>
<asp:View ID="View3" runat="server">
<asp:SqlDataSource ID="dsBPRMGrid" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="Data Source=(local);Initial Catalog=THINKYU_WEB;Persist Security Info=True;User ID=sa"
OnSelected="dsBPRM_Selected"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT * FROM BPRM"></asp:SqlDataSource>
<asp:ObjectDataSource ID="dsBPRMGrid" runat="server"
TypeName="BprmDAC" SelectMethod="SelectPage" SelectCountMethod="SelectCount"
EnablePaging="true" OnSelected="dsBPRMGrid_Selected">
<SelectParameters>
<asp:Parameter Name="BPPNM" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:SqlDataSource ID="dsBPRMForm" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="Data Source=(local);Initial Catalog=THINKYU_WEB;Persist Security Info=True;User ID=sa" DeleteCommand="DELETE FROM BPRM
+9 -12
View File
@@ -19,10 +19,6 @@ using System.Data.Common;
public partial class forms_customer_fmBprm : Wellan.Web.UI.WUserControlBase
{
protected string _BPPNM = "";
private string select = "SELECT * ";
private string from = " FROM BPRM ";
private string where = " WHERE 1=1 ";
private string order = " ORDER BY BPENO";
protected void Page_Load(object sender, EventArgs e)
{
@@ -181,14 +177,15 @@ public partial class forms_customer_fmBprm : Wellan.Web.UI.WUserControlBase
// 查詢動作
private new void Search()
{
StringBuilder sql = new StringBuilder();
sql.Append(select);
sql.Append(from);
sql.Append(where);
dsBPRMGrid.SelectParameters.Clear();
AddSearch(sql, dsBPRMGrid, "BPPNM", _BPPNM, "", true);
sql.Append(order);
dsBPRMGrid.SelectCommand = sql.ToString();
dsBPRMGrid.SelectParameters["BPPNM"].DefaultValue = _BPPNM;
}
protected void dsBPRMGrid_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
if (e.ReturnValue is Int32 && WDAC.GetInt32Value(e.ReturnValue) == 0)
{
fvBPRM.ChangeMode(FormViewMode.Insert);
}
}
protected void dsBPRM_Selected(object sender, SqlDataSourceStatusEventArgs e)