当前位置: 首页>>代码示例>>C#>>正文


C# SqlDataRecord.SetSqlBoolean方法代码示例

本文整理汇总了C#中Microsoft.SqlServer.Server.SqlDataRecord.SetSqlBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataRecord.SetSqlBoolean方法的具体用法?C# SqlDataRecord.SetSqlBoolean怎么用?C# SqlDataRecord.SetSqlBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.SqlServer.Server.SqlDataRecord的用法示例。


在下文中一共展示了SqlDataRecord.SetSqlBoolean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BindFile

 private static void BindFile(FileInfo _file, SqlDataRecord record)
 {
     record.SetSqlDateTime(0, _file.Exists ? _file.CreationTime : SqlDateTime.Null);
     record.SetSqlDateTime(1, _file.Exists ? _file.LastAccessTime : SqlDateTime.Null);
     record.SetSqlDateTime(2, _file.Exists ? _file.LastWriteTime : SqlDateTime.Null);
     record.SetSqlBoolean(3, _file.Exists);
     record.SetString(4, _file.Name);
     record.SetString(5, _file.DirectoryName);
     record.SetString(6, _file.Extension);
     record.SetSqlInt64(7, _file.Exists ? _file.Length : SqlInt64.Null);
 }
开发者ID:mvasilva,项目名称:SqlServerExtension,代码行数:11,代码来源:FileManager.cs

示例2: AddParameters

        public void AddParameters(IDbCommand command, SqlMapper.Identity identity)
        {
            var sqlCommand = (SqlCommand)command;
            sqlCommand.CommandType = CommandType.StoredProcedure;

            var groups = new List<SqlDataRecord>();
            var rules = new List<SqlDataRecord>();

            SqlMetaData[] groupSqlType =
            {
                new SqlMetaData("RuleGroupID", SqlDbType.Int),
                new SqlMetaData("GroupGuid", SqlDbType.VarChar, 32),
                new SqlMetaData("IsSystem", SqlDbType.Bit),
                new SqlMetaData("DisplayOrder", SqlDbType.Int),
                new SqlMetaData("[Enabled]", SqlDbType.Bit)
            };

            SqlMetaData[] ruleSqlType =
            {
                new SqlMetaData("RuleDetailID", SqlDbType.Int),
                new SqlMetaData("RuleTypeID", SqlDbType.Int),
                new SqlMetaData("GroupGuid", SqlDbType.Char, 32),
                new SqlMetaData("RuleConfiguration", SqlDbType.Xml),
                new SqlMetaData("[Enabled]", SqlDbType.Bit)
            };

            foreach (RuleGroup group in this._groups)
            {
                var groupRecord = new SqlDataRecord(groupSqlType);
                string groupGuid = Guid.NewGuid().ToString().Replace("-", string.Empty);

                groupRecord.SetInt32(0, group.ID);
                groupRecord.SetString(1, groupGuid);
                groupRecord.SetBoolean(2, group.IsSystem);
                groupRecord.SetInt32(3, group.DisplayOrder);
                groupRecord.SetBoolean(4, group.IsEnabled);
                groups.Add(groupRecord);

                foreach (var rule in group.Rules)
                {
                    var ruleRecord = new SqlDataRecord(ruleSqlType);
                    var ruleType = (int)rule.RuleTypeID;

                    ruleRecord.SetInt32(0, rule.ID);
                    ruleRecord.SetInt32(1, ruleType);
                    ruleRecord.SetString(2, groupGuid);
                    ruleRecord.SetString(3, this.RuleWriter(rule));
                    ruleRecord.SetSqlBoolean(4, rule.IsEnabled);
                    rules.Add(ruleRecord);
                }
            }

            var userIDParam = sqlCommand.Parameters.Add("UserID", SqlDbType.Int);
            userIDParam.Value = this._userID;

            var profileIDParam = sqlCommand.Parameters.Add("ProFileID", SqlDbType.Int);
            profileIDParam.Value = this._profileID;

            var profileNameParam = sqlCommand.Parameters.Add("ProfileName", SqlDbType.VarChar, 50);
            profileNameParam.Value = this._profileName;

            var groupsPAram = sqlCommand.Parameters.Add("Groups", SqlDbType.Structured);
            groupsPAram.TypeName = "RulesGroupTableType";
            groupsPAram.Value = groups;

            var rulesParam = sqlCommand.Parameters.Add("Rules", SqlDbType.Structured);
            rulesParam.TypeName = "RulesTableType";
            rulesParam.Value = rules;
        }
开发者ID:luigilabel,项目名称:RulesEngine,代码行数:69,代码来源:GroupDynamicParam+.cs


注:本文中的Microsoft.SqlServer.Server.SqlDataRecord.SetSqlBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。