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

📄 myresultsets.designer.cs

📁 Microsoft Mobile Development Handbook的代码,有C#,VB,C++的
💻 CS
字号:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MobileDevelopersHandbook.MyResultSetsResultSets {
    using System;
    using System.Data;
    
    
    public partial class ProductCategoryResultSet : System.Data.SqlServerCe.SqlCeResultSet {
        
        private string resultSetConnectionString = null;
        
        private System.Data.SqlServerCe.SqlCeConnection sqlCeConnection = null;
        
        private System.Data.SqlServerCe.ResultSetOptions resultSetOptions;
        
        public ProductCategoryResultSet() {
            // Create default options
            // 
            resultSetOptions = System.Data.SqlServerCe.ResultSetOptions.Scrollable;
            resultSetOptions = (resultSetOptions | System.Data.SqlServerCe.ResultSetOptions.Sensitive);
            resultSetOptions = (resultSetOptions | System.Data.SqlServerCe.ResultSetOptions.Updatable);
            // To enable design time support, the resultSetConnectionString property needs to switched between a Designtime and Runtime connection string.
            // The design time connection string is used to make a valid connection to the database and retrieve schema information.
            // 
            if (MyResultSetsUtil.DesignerUtil.IsDesignTime()) {
                // Designtime Connection String
                resultSetConnectionString = "Data Source =\"C:\\Documents and Settings\\Andy\\My Documents\\Compact Framework Book " +
                    "V2.0\\Drafts\\Chapter 3\\Sample Code\\SQLCEDataSourceQuickUI\\SQLCEDataSourceQuickUI\\" +
                    "MyDatabase.sdf\"; Password =\"MobileP@ssw0rd\";";
            }
            else {
                // Runtime Connection String
                resultSetConnectionString = ("Data Source =" 
                            + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) 
                            + ("\\MyDatabase.sdf;" 
                            + ("Password =" + "\"MobileP@ssw0rd\";"))));
            }
            // Call Open() to initialize the ResultSet
            // 
            this.Open();
        }
        
        public ProductCategoryResultSet(string connectionString, System.Data.SqlServerCe.ResultSetOptions options) {
            resultSetConnectionString = connectionString;
            resultSetOptions = options;
            this.Open();
        }
        
        public System.Data.SqlServerCe.SqlCeConnection Connection {
            get {
                return sqlCeConnection;
            }
        }
        
        public int ProductCategoryID {
            get {
                return ((int)(base.GetInt32(base.GetOrdinal("ProductCategoryID"))));
            }
            set {
                base.SetInt32(base.GetOrdinal("ProductCategoryID"), value);
            }
        }
        
        public string Name {
            get {
                return ((string)(base.GetString(base.GetOrdinal("Name"))));
            }
            set {
                base.SetString(base.GetOrdinal("Name"), value);
            }
        }
        
        public void Open() {
            System.Data.SqlServerCe.SqlCeCommand sqlCeSelectCommand;
            // Open a connection to the database
            // 
            sqlCeConnection = new System.Data.SqlServerCe.SqlCeConnection(this.resultSetConnectionString);
            sqlCeConnection.Open();
            // Create the command
            // 
            sqlCeSelectCommand = sqlCeConnection.CreateCommand();
            sqlCeSelectCommand.CommandText = "ProductCategory";
            sqlCeSelectCommand.CommandType = System.Data.CommandType.TableDirect;
            // Generate the ResultSet
            // 
            sqlCeSelectCommand.ExecuteResultSet(this.resultSetOptions, this);
        }
        
        public void MoveToRow(int Row) {
            base.ReadAbsolute(Row);
        }
        
        public void DeleteRecord() {
            base.Delete();
        }
        
        public void AddProductCategoryRecord(string Name) {
            System.Data.SqlServerCe.SqlCeUpdatableRecord newRecord = base.CreateRecord();
            newRecord["Name"] = Name;
            base.Insert(newRecord);
        }
        
        public void Bind(System.Windows.Forms.BindingSource bindingSource) {
            bindingSource.DataSource = this.ResultSetView;
        }
    }
}
namespace MyResultSetsUtil {
    using System;
    using System.Data;
    
    
    public partial class DesignerUtil {
        
        public static bool IsDesignTime() {
            // Determine if this instance is running against .NET Framework by using the MSCoreLib PublicKeyToken
            System.Reflection.Assembly mscorlibAssembly = typeof(int).Assembly;
            if ((mscorlibAssembly != null)) {
                if (mscorlibAssembly.FullName.ToUpper().EndsWith("B77A5C561934E089")) {
                    return true;
                }
            }
            return false;
        }
        
        public static bool IsRunTime() {
            // Determine if this instance is running against .NET Compact Framework by using the MSCoreLib PublicKeyToken
            System.Reflection.Assembly mscorlibAssembly = typeof(int).Assembly;
            if ((mscorlibAssembly != null)) {
                if (mscorlibAssembly.FullName.ToUpper().EndsWith("969DB8053D3322AC")) {
                    return true;
                }
            }
            return false;
        }
    }
}

⌨️ 快捷键说明

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