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


C# SqlString.ToString方法代码示例

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


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

示例1: FindPHkeysAndSlots

    public static IEnumerable FindPHkeysAndSlots(SqlInt16 partsnap, SqlInt16 fofsnap, SqlString temp_partid_table_name, SqlInt32 numparts)
    {
        //string temp_partid_table = "#temp_partid_list";
        List<PhkeySlot> keysAndSlots = new List<PhkeySlot>();
        using (SqlConnection connection = new SqlConnection("context connection=true"))
        {
            connection.Open();
            string getFoFGroupIDsCommandString = "select partid from " + temp_partid_table_name.ToString();
            SqlCommand getFoFGroupIDsListCommand = new SqlCommand(getFoFGroupIDsCommandString, connection);
            SqlDataReader getFOFGroupIDsReader = getFoFGroupIDsListCommand.ExecuteReader();
            Int64[] partids = new Int64[(int) numparts];
            int numlines = 0;
            while (getFOFGroupIDsReader.Read())
            {
                partids[numlines] = Int64.Parse(getFOFGroupIDsReader["partid"].ToString());
                ++numlines;
            }
            getFOFGroupIDsReader.Close();
            // Find the index blocks we need to look in
            HashSet<Int64> blocks = new HashSet<Int64>();
            foreach (Int64 id in partids)
            {
                blocks.Add((id - 1) / 1024 / 1024);
            }

            //means we want all snaps
            string rawCommand = "";
            if (partsnap < 0)
            {
                rawCommand = "select a.snap, a.phkey, a.slot from particleDB.dbo.index{0} a, " + temp_partid_table_name.ToString() + " b "
                    + " where a.partid = b.partid";
            }
            else
            {
                rawCommand = "select a.snap, a.phkey, a.slot from particleDB.dbo.index{0} a, " + temp_partid_table_name.ToString() + " b "
                    + " where a.partid = b.partid and a.snap = @partsnap";
            }

            foreach (Int64 blockID in blocks)
            {
                string joinFoFGroupIndexCommandString = string.Format(rawCommand, blockID);
                SqlCommand joinFofGroupIndexCommand = new SqlCommand(joinFoFGroupIndexCommandString, connection);
                SqlParameter partsnapParam = new SqlParameter("@partsnap", System.Data.SqlDbType.SmallInt);
                partsnapParam.Value = partsnap;
                joinFofGroupIndexCommand.Parameters.Add(partsnapParam);
                SqlDataReader joinReader = joinFofGroupIndexCommand.ExecuteReader();
                while (joinReader.Read())
                {
                    int snap = Int32.Parse(joinReader["snap"].ToString());
                    int phkey = Int32.Parse(joinReader["phkey"].ToString());
                    short slot = Int16.Parse(joinReader["slot"].ToString());
                    PhkeySlot current = new PhkeySlot(snap, phkey, slot);
                    keysAndSlots.Add(current);
                }
                joinReader.Close();
            }
        }
        return keysAndSlots;
    }
开发者ID:dcrankshaw,项目名称:GadgetLoader,代码行数:59,代码来源:IndexLookup.cs

示例2: throwExceptionIfSchemaIsEmpty

 private static void throwExceptionIfSchemaIsEmpty(SqlString command, DataTable schema)
 {
     if (schema == null) 
     {
         throw new InvalidResultSetException("The command [" + command.ToString() + "] did not return a result set");
     }
 }
开发者ID:DFineNormal,项目名称:tSQLt,代码行数:7,代码来源:MetaDataEqualityAsserter.cs

示例3: GetAlterStatementWithoutSchemaBinding

 public static SqlChars GetAlterStatementWithoutSchemaBinding(SqlString createStatement)
 {
     var startPosition = GetStartPosition(createStatement);
     var regex = new Regex(@"CREATE\s+VIEW(\s*.*?\s*)WITH\s+SCHEMABINDING\s+AS");
     var output = regex.Replace(createStatement.ToString(), @"ALTER VIEW$1AS", 1, startPosition);
     return new SqlChars(output);
 }
开发者ID:tSQLt,项目名称:tmp,代码行数:7,代码来源:tSQLtPrivate.cs

示例4: GetPinYin

 public static SqlString GetPinYin(SqlString word)
 {
     // 汉字 to 拼音首字母.
     string result = GetChineseSpell(word.ToString());
     // 返回.
     return new SqlString(result);
 }
开发者ID:mahuidong,项目名称:my-csharp-sample,代码行数:7,代码来源:GetPinYin.cs

示例5: Execute

        public void Execute(SqlString command)
        {

            SqlConnection conn = null;
            try
            {

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Suppress))
                {
                    String connectionString = CreateConnectionStringToContextDatabase();
                    conn = new SqlConnection(connectionString);

                    conn.Open();

                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = conn;
                    cmd.CommandText = command.ToString();
                    cmd.ExecuteNonQuery();
                }
            }
            catch (SecurityException se)
            {
                throw new CommandExecutorException("Error connecting to database. You may need to create tSQLt assembly with EXTERNAL_ACCESS.", se);
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
开发者ID:DFineNormal,项目名称:tSQLt,代码行数:32,代码来源:CommandExecutor.cs

示例6: DetermineCompressionRate

 public static SqlDouble DetermineCompressionRate(SqlBinary originalEncodedValue, SqlString decodedValue)
 {
     int decodedValueLength = decodedValue.ToString().Length;
     int encodedValueLength = originalEncodedValue.Value.Length;
     double rate = (double)encodedValueLength / (double)decodedValueLength;
     return new SqlDouble(rate);
 }
开发者ID:szalaigj,项目名称:LoaderToolkit,代码行数:7,代码来源:DetermineCompressionRate.cs

示例7: GetSkyline

 public static void GetSkyline(SqlString strQuery, SqlString strOperators, SqlInt32 numberOfRecords, SqlInt32 sortType, SqlInt32 upToLevel)
 {
     SPMultipleSkylineBNLLevel skyline = new SPMultipleSkylineBNLLevel();
     string[] additionalParameters = new string[5];
     additionalParameters[4] = upToLevel.ToString();
     skyline.GetSkylineTable(strQuery.ToString(), strOperators.ToString(), numberOfRecords.Value, false, Helper.CnnStringSqlclr, Helper.ProviderClr, additionalParameters, sortType.Value, true);
 }
开发者ID:Bulld0zzer,项目名称:prefSQL,代码行数:7,代码来源:SPMultipleSkylineBNLLevel.cs

示例8: CompStrings

 public CompStrings(SqlString from, SqlString to, SqlString replace, SqlString tolerance, SqlString comp) {
     this.from = from.ToString();
     this.to = to.ToString();
     this.replace = replace.ToString();
     this.tolerance = tolerance.ToString();
     this.comp = comp.ToString();
 }
开发者ID:wbuchanan,项目名称:whyWontSQLServerImplementRegexNatively,代码行数:7,代码来源:CompStrings.cs

示例9: GetParam

 public static int GetParam(SqlString s)
 {
     // 在此处放置代码
     Regex _break_comp = new Regex(@"\{\d\}", RegexOptions.Compiled);
     return  _break_comp.Matches(s.ToString() ).Count;
     //return new SqlString("Hello");
 }
开发者ID:fatbudy,项目名称:CSSM,代码行数:7,代码来源:Function1.cs

示例10: countUsbLog

        // 全ての件数を取得
        public int[] countUsbLog()
        {
            int[] arrCount = new int[2];

            DateTime dtToday = DateTime.Now;
            string today     = dtToday.ToString("yyyy-MM-dd");

            try {
                db.conn.Open();
                // 最初のループで今日のレコード件数について取得
                for (int i = 0; i < 2; i++) {
                    MySqlCommand commCountUsbLog = new MySqlCommand("SELECT COUNT(log_id) FROM t_log", db.conn);
                    // 最初の実行で今日のログを取得するSQLを実行
                    if (i == 0) {
                        SqlString condition =  new SqlString(" WHERE log_time LIKE '" + today + "%'");
                        commCountUsbLog.CommandText += condition.ToString();
                    }

                    db.debugSql = commCountUsbLog.CommandText;
                    arrCount[i] = Convert.ToInt32(commCountUsbLog.ExecuteScalar());
                }

                db.conn.Close();
            } catch (MySqlException e) {
                db.exceptionMsg = "エラーコード:" + e.ErrorCode + "<br>エラー内容:" + e.Message + "<br>エラー原因:" + e.Source;
                Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
                Debug.WriteLine(db.exceptionMsg);
                Debug.WriteLine(db.debugSql);
            }

            return arrCount;
        }
开发者ID:tomoyashibata,项目名称:UsbLogger,代码行数:33,代码来源:DbUsb.cs

示例11: GetSkyline

        public static void GetSkyline(SqlString strQuery, SqlString strOperators, SqlInt32 numberOfRecords,
            SqlInt32 sortType, SqlInt32 count, SqlInt32 dimension, SqlString algorithm, SqlBoolean hasIncomparable)
        {
            try
            {
                Type strategyType = Type.GetType("prefSQL.SQLSkyline." + algorithm.ToString());

                if (!typeof (SkylineStrategy).IsAssignableFrom(strategyType))
                {
                    throw new Exception("passed algorithm is not of type SkylineStrategy.");
                }

                var strategy = (SkylineStrategy) Activator.CreateInstance(strategyType);

                strategy.Provider = Helper.ProviderClr;
                strategy.ConnectionString = Helper.CnnStringSqlclr;
                strategy.RecordAmountLimit = numberOfRecords.Value;
                strategy.HasIncomparablePreferences = hasIncomparable.Value;
                strategy.SortType = sortType.Value;

                var skylineSample = new SkylineSampling
                {
                    SubsetCount = count.Value,
                    SubsetDimension = dimension.Value,
                    SelectedStrategy = strategy
                };

                DataTable dataTableReturn = skylineSample.GetSkylineTable(strQuery.ToString(), strOperators.ToString());
                SqlDataRecord dataRecordTemplate = skylineSample.DataRecordTemplateForStoredProcedure;

                //throw new Exception(dataTableReturn.Rows[0].Table.Columns.Count.ToString());

                if (SqlContext.Pipe != null)
                {
                    SqlContext.Pipe.SendResultsStart(dataRecordTemplate);

                    foreach (DataRow recSkyline in dataTableReturn.Rows)
                    {
                        for (var i = 0; i < recSkyline.Table.Columns.Count; i++)
                        {
                            dataRecordTemplate.SetValue(i, recSkyline[i]);
                        }
                        SqlContext.Pipe.SendResultsRow(dataRecordTemplate);
                    }
                    SqlContext.Pipe.SendResultsEnd();
                }
            }
            catch (Exception ex)
            {
                //Pack Errormessage in a SQL and return the result
                var strError = "Error in prefSQL_SkylineSampling: ";
                strError += ex.Message;

                if (SqlContext.Pipe != null)
                {
                    SqlContext.Pipe.Send(strError);
                }
            }
        }
开发者ID:Bulld0zzer,项目名称:prefSQL,代码行数:59,代码来源:SPSkylineSampling.cs

示例12: Accumulate

 public void Accumulate(SqlString Value, SqlString delimiter)
 {
     _delimiter = delimiter.Value;
     if (Value.IsNull == false)
     {
         _elements.Add(Value.ToString());
     }
 }
开发者ID:ben-thul,项目名称:SQLCLR,代码行数:8,代码来源:Concatenate.cs

示例13: CommandCall

    public static void ResultSetCapture 
       (SqlString Command, 
        SqlString rsTable1, SqlString rsColumnList1, 
        SqlString rsTable2, SqlString rsColumnList2
       )
    {
        // Storage for the parameters: 
        CommandCall cmd = new CommandCall();

        // the command to execute
        cmd.Command = Command.ToString();

        // the tables to hold the result sets produced
        cmd.rsTable = new List<ResultTables>();

        // rsTableN where N = result set sequence number
        // rsColumnList is the list of columns to capture * = All
        if ( rsTable1.ToString() != "")
        {            
            cmd.rsTable.Add(new ResultTables { resultSetSeq = 1, tableName = rsTable1.ToString(), columnList = rsColumnList1.ToString().ToLower() });
        }
        
        if  ( rsTable2.ToString() != "" )
        {
            cmd.rsTable.Add(new ResultTables { resultSetSeq = 2, tableName = rsTable2.ToString(), columnList = rsColumnList2.ToString().ToLower() });
        }
       
        //*******************************************************************

        // Execute & Save results to a dataSet
        DataSet CommnandResults = CommandCallUtilities.ExecCommand(cmd);

        DataSet dsTargetTablesOut = CommandCallUtilities.getTargetTableMetaData(cmd);

        // Build a dataset with the output tables
        DataSet dsResultSetSchema = CommandCallUtilities.getResultSetMetaData(cmd);

        // Use the columnList choose the columns and meta data from the result set
        // and then add any columns that are missing to the target table

        // Map the columns of the result set to the columns of the output table; 
        bool result = CommandCallUtilities.mapResultsToOutputTables(CommnandResults, dsTargetTablesOut, dsResultSetSchema, cmd);

        return;
    }
开发者ID:csilbergleith,项目名称:ResultSetCapture,代码行数:45,代码来源:ResultSetCapture.cs

示例14: GetRanking

 public static void GetRanking(SqlString strQuery, SqlString strSelectExtremas, SqlInt32 numberOfRecords, SqlString strRankingWeights, SqlString strRankingExpressions, SqlBoolean showInternalAttr, SqlString strColumnNames)
 {
     SPRanking ranking = new SPRanking();
     ranking.Provider = Helper.ProviderClr;
     ranking.ConnectionString = Helper.CnnStringSqlclr;
     ranking.RecordAmountLimit = numberOfRecords.Value;
     ranking.ShowInternalAttributes = showInternalAttr.Value;
     ranking.GetRankingTable(strQuery.ToString(), false, strSelectExtremas.ToString(), strRankingWeights.ToString(), strRankingExpressions.ToString(), strColumnNames.ToString());
 }
开发者ID:Bulld0zzer,项目名称:prefSQL,代码行数:9,代码来源:SPRanking.cs

示例15: Accumulate

 public void Accumulate(SqlString value, SqlString separator)
 {
     if (value.IsNull || separator.IsNull) return;
     if (intermediateResult.Length == 0)
       intermediateResult.Append(value.Value);
     else
       intermediateResult.Append(value.ToString().Insert(0, separator.Value));
     separatorResult = separator.Value;
 }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:9,代码来源:Format.cs


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