⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resultsetform.cs

📁 Microsoft Mobile Development Handbook的代码,有C#,VB,C++的
💻 CS
字号:
using System;
using System.Data.SqlServerCe;
using System.Windows.Forms;

namespace MobileDevelopersHandbook
{
    public partial class ResultSetForm : Form
    {
        private MobileDevelopersHandbook.MyResultSetsResultSets.ProductResultSet productResultSet;
        private MobileDevelopersHandbook.MyResultSetsResultSets.ProductCategoryResultSet productCategoryResultSet;
    
        public ResultSetForm()
        {
            InitializeComponent();
        }

        private void ResultSetForm_Load(object sender, EventArgs e)
        {
            // TODO: Delete this line of code to remove the default AutoFill for 'MobileDevelopersHandbook.MyResultSetsResultSets.ProductResultSet'.
            //productResultSet = new MobileDevelopersHandbook.MyResultSetsResultSets.ProductResultSet();
            //productResultSet.Bind(this.productResultSetBindingSource);
            // TODO: Delete this line of code to remove the default AutoFill for 'MobileDevelopersHandbook.MyResultSetsResultSets.ProductCategoryResultSet'.
            productCategoryResultSet = new MobileDevelopersHandbook.MyResultSetsResultSets.ProductCategoryResultSet();
            productCategoryResultSet.Bind(this.productCategoryResultSetBindingSource);

            // Setup the child records data source
            SetProductResultSet();
        }

        private void productCategoryResultSetDataGrid_CurrentCellChanged(object sender, EventArgs e)
        {
            SqlCeResultSet oldRS = this.productResultSet;

            // User has clicked on the grid
            SetProductResultSet();

            // Dispose of the redundant SqlCEResultSet
            oldRS.Dispose();
        }

        private void SetProductResultSet()
        {
            // Find the ProductCategoryID of the selected record
            int prodCatID = (int)((RowView)this.productCategoryResultSetBindingSource.Current).UpdatableRecord["ProductCategoryID"];

            // Create new resultset using our 'custom' constructor
            productResultSet = new MyResultSetsResultSets.ProductResultSet(false);
            // Filter on the index we created earlier, and only the 
            // required ProductCategoryID
            productResultSet.Open("ProductCategoryID_idx", prodCatID, prodCatID);

            // Bind the BindingSource
            productResultSet.Bind(this.productResultSetBindingSource);
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -