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


C# SqlDataRecord.SetSqlString方法代码示例

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


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

示例1: buildRecord

    private static SqlDataRecord buildRecord(SqlMetaData[] metadata,EventLogEntry entry)
    {
        SqlDataRecord record     = new SqlDataRecord(metadata);

        record.SetSqlInt32(0, entry.Index);
        record.SetSqlInt64(1, entry.InstanceId);
        record.SetSqlDateTime(2, entry.TimeWritten);
        record.SetSqlString(3, entry.MachineName);
        record.SetSqlString(4, entry.Source);
        record.SetSqlString(5, entry.UserName);
        record.SetSqlString(6, entry.Message);

        return record;
    }
开发者ID:csilbergleith,项目名称:CLRLogReader,代码行数:14,代码来源:LogEntries.cs

示例2: CreateStringIdRecord

        private static SqlDataRecord CreateStringIdRecord(string id)
        {
            var record = new SqlDataRecord(new SqlMetaData("Id", SqlDbType.NVarChar, 16));

            record.SetSqlString(0, id);

            return record;
        }
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:8,代码来源:SqlServerIdsTableParam.cs

示例3: AddSurveyTokensMultiple

        public void AddSurveyTokensMultiple(int surveyId, DateTime creationDate, IEnumerable<string> tokens)
        {
            SqlMetaData[] tab = { new SqlMetaData("value", SqlDbType.VarChar, 40) };
            List<SqlDataRecord> tokenList =
            tokens.Select(x => { var y = new SqlDataRecord(tab); y.SetSqlString(0, x); return y; }).ToList<SqlDataRecord>();

            SqlParameter p = new SqlParameter("@tblTokenList", SqlDbType.Structured);
            p.Direction = ParameterDirection.Input;
            p.TypeName = "dbo.VarcharTableType";
            p.Value = tokenList;

            SqlCommand cmd = new SqlCommand();
            using (SqlConnection conn = new SqlConnection(DbConnection.NewDbConnectionString))
            {
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "vts_spSurveyTokenAddMultiple";
                cmd.Parameters.Add(p);
                cmd.Parameters.Add(new SqlParameter("@SurveyID", surveyId));
                cmd.Parameters.Add(new SqlParameter("@CreationDate", creationDate));

                cmd.ExecuteNonQuery();
            }
            //   SqlHelper.ExecuteNonQuery(SqlHelper.DbConnectionString, "vts_spSurveyTokenAddMultiple", pars);

        }
开发者ID:ChrisNelsonPE,项目名称:surveyproject_main_public,代码行数:27,代码来源:SurveyToken.cs

示例4: Should_be_able_to_map_from_a_data_record

        public void Should_be_able_to_map_from_a_data_record()
        {
            var record = new SqlDataRecord(new[] { new SqlMetaData("column-1", SqlDbType.VarChar, 65) });

            record.SetSqlString(0, new SqlString(null));

            var column1 = new MappedColumn<string>("column-1", DbType.AnsiString, 65);
            var column2 = new MappedColumn<string>("column-2", DbType.AnsiString, 65);

            Assert.AreEqual(default(string), column1.MapFrom(record));
            Assert.AreEqual(default(string), column2.MapFrom(record));

            record.SetSqlString(0, new SqlString("value-1"));

            Assert.AreEqual("value-1", column1.MapFrom(record));
            Assert.AreEqual(default(string), column2.MapFrom(record));
        }
开发者ID:ltvan,项目名称:shuttle-core-data,代码行数:17,代码来源:MappedColumnTests.cs

示例5: SendCommandStatus

        private static void SendCommandStatus(SqlPipe pipe, SqlInt32 status, SqlString substatus)
        {
            SqlDataRecord rec = new SqlDataRecord(
                  new SqlMetaData("Status", SqlDbType.Int)
                , new SqlMetaData("SubStatus", SqlDbType.NVarChar, 150)
                );

            SqlContext.Pipe.SendResultsStart(rec);

            rec.SetSqlInt32(0, status);
            rec.SetSqlString(1, substatus);

            pipe.SendResultsRow(rec);
            pipe.SendResultsEnd();

        }
开发者ID:mbmccormick,项目名称:Ximura,代码行数:16,代码来源:Entity_Common.cs


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