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


C# SqlDataRecord.SetInt32方法代码示例

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


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

示例1: IR_SM_PriceList_PerType

 public static void IR_SM_PriceList_PerType()
 {
     using (SqlConnection con = new SqlConnection("context connection=true"))
     {
         SqlPipe pipe = SqlContext.Pipe;
         List<SqlCommand> commands = new List<SqlCommand>();
         try
         {
             commands.Add(new SqlCommand("SELECT DISTINCT IR_PriceList.PRICE, IR_PriceList.YEAR AS YearT, IR_PriceList.MONTH AS MonthT, IR_PriceList.SAPRODUCTCODE, IR_PriceList.PRICETYPE FROM IR_PriceList"));
             SqlDataRecord record = new SqlDataRecord(new SqlMetaData("PRICE", SqlDbType.Float),
             new SqlMetaData("MonthT", SqlDbType.Int),
             new SqlMetaData("YearT", SqlDbType.Int),
             new SqlMetaData("SAPRODUCTCODE", SqlDbType.NVarChar, 20),
             new SqlMetaData("PRICETYPE", SqlDbType.NVarChar, 20));
             pipe.SendResultsStart(record);
             foreach (SqlCommand cmd in commands)
             {
                 try
                 {
                     cmd.Connection = con;
                     con.Open();
                     SqlDataReader dr = cmd.ExecuteReader();
                     while (dr.Read())
                     {
                         double price = Convert.ToDouble(dr["PRICE"]);
                         int month = Convert.ToInt32(dr["montht"]);
                         int year = Convert.ToInt32(dr["yeart"]);
                         string saproductcode = Convert.ToString(dr["SAPRODUCTCODE"]);
                         string thePriceType = Convert.ToString(dr["PRICETYPE"]);
                         record.SetDouble(0, price);
                         record.SetInt32(1, month);
                         record.SetInt32(2, year);
                         record.SetString(3, saproductcode);
                         record.SetString(4, thePriceType);
                         pipe.SendResultsRow(record);
                     }
                 }
                 catch (Exception ex)
                 {
                     throw ex;
                 }
                 finally
                 {
                     if (con != null)
                         con.Close();
                 }
             }
             pipe.SendResultsEnd();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
开发者ID:naimheshmati,项目名称:Sanofi,代码行数:55,代码来源:IR_SM_PriceList_PerType.cs

示例2: SetIntRecord

 public static void SetIntRecord(SqlDataReader dr,string columnName, SqlDataRecord record, int ordinal)
 {
     if (dr[columnName] == DBNull.Value)
         record.SetDBNull(ordinal);
     else
         record.SetInt32(ordinal, Convert.ToInt32(dr[columnName]));
 }
开发者ID:naimheshmati,项目名称:Sanofi,代码行数:7,代码来源:Utils.cs

示例3: FillRecord

    private static SqlDataRecord FillRecord(Int32 pk, SqlDataRecord record)
    {
        Int32 age = SlowRandom(16, 99);
        string sourceString = "Age: " + age.ToString();
        DateTime sourceDate = DateTime.UtcNow;

        var data = /*salt + */sourceString;
                
        string key = "Top Secret Key";

        var encData = AES.EncryptBytes(data, key);
        //var encDataBytes = Encoding.Unicode.GetBytes(encData);
        var decData = AES.DecryptBytes(encData, key);

        var sha = new SHA256Managed();
        byte[] dataSHA256 = sha.ComputeHash(encData/*Bytes*/);
        sha.Dispose();

        // конвертирую хеш из byte[16] в строку шестнадцатиричного формата
        // (вида «3C842B246BC74D28E59CCD92AF46F5DA»)
        // это опциональный этап, если вам хеш нужен в строковом виде
        // string sha512hex = BitConverter.ToString(dataSHA512).Replace("-", string.Empty); 

        record.SetInt32(0, pk);
        record.SetDateTime(1, sourceDate);        
        record.SetString(2, sourceString);
        record.SetString(3, Convert.ToBase64String(dataSHA256)); // sha256
        record.SetString(4, Convert.ToBase64String(encData)); // Encrypted
        record.SetString(5, decData); // Decrypted

        return record;
    }
开发者ID:CatBayun,项目名称:WCF.First-Steps,代码行数:32,代码来源:SQLExtentions.cs

示例4: IR_SM_AvailableObjective

    public static void IR_SM_AvailableObjective()
    {
        using (SqlConnection con = new SqlConnection("context connection=true"))
        {
            SqlPipe pipe = SqlContext.Pipe;
            List<SqlCommand> commands = new List<SqlCommand>();

            commands.Add(new SqlCommand("SELECT distinct [BUDGETTYPECODE] as ObjectiveType, [YEAR] as YearT, BRANDCODE as BrandCode FROM [SALESBUDGET] inner join SAPRODUCTS on SAPRODUCTS.saproductcode = salesbudget.saproductcode order by BRANDCODE"));
            commands.Add(new SqlCommand("SELECT distinct [type] as ObjectiveType, [year] as YearT, [brandcode]  as BrandCode FROM [IR_Brand_Budget] order by brandcode"));

            SqlDataRecord record = new SqlDataRecord(new SqlMetaData("ObjectiveType", SqlDbType.NVarChar, 50),
                                    new SqlMetaData("YearT", SqlDbType.Int),
                                    new SqlMetaData("BrandCode", SqlDbType.NVarChar, 50),
                                    new SqlMetaData("TotalProvince", SqlDbType.NVarChar, 50));

            pipe.SendResultsStart(record);

            bool isTotal = true; 
            foreach (SqlCommand cmd in commands)
            {
                try
                {
                    cmd.Connection = con;
                    con.Open();


                    SqlDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        string objectiveType = Convert.ToString(dr["objectivetype"]);
                        int year = Convert.ToInt32(dr["yeart"]);
                        string brandCode = Convert.ToString(dr["brandcode"]);
                        string totalProvince = (isTotal) ? "T" : "P";

                        record.SetString(0, objectiveType);
                        record.SetInt32(1, year);
                        record.SetString(2, brandCode);
                        record.SetString(3, totalProvince);
                        pipe.SendResultsRow(record);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (con != null)
                        con.Close();
                    isTotal = false;
                }
            }
            pipe.SendResultsEnd();
        }
    }
开发者ID:naimheshmati,项目名称:Sanofi,代码行数:55,代码来源:IR_SM_AvailableObjective.cs

示例5: TSqlDataRecord

        public static IEnumerable<SqlDataRecord> TSqlDataRecord(List<Modulo> ListaModulo)
        {
            List<SqlDataRecord> listaSqlDataRecord = new List<SqlDataRecord>();

            foreach (Modulo oModulo in ListaModulo)
            {
                SqlDataRecord oSqlDataRecord = new SqlDataRecord(
                    new SqlMetaData[]{ new SqlMetaData("nMenuId", SqlDbType.Int),
                                        new SqlMetaData("nModId", SqlDbType.Int),
                                        new SqlMetaData("nValor", SqlDbType.Bit)
                                    });

                oSqlDataRecord.SetInt32(0, oModulo.nMenuId);
                oSqlDataRecord.SetInt32(1, oModulo.nModId);
                oSqlDataRecord.SetBoolean(2, oModulo.bEstado);
                listaSqlDataRecord.Add(oSqlDataRecord);
            }

            return listaSqlDataRecord;
        }
开发者ID:AmadoDomper,项目名称:CHUYAChuya,代码行数:20,代码来源:ListaModuloCollection.cs

示例6: GerarEventoAuditoria

        public static void GerarEventoAuditoria(this DbContext context, int codigoTipoEventoAuditoria, Func<int> idUsuarioFunc, params ParametroEvento[] parametrosEvento)
        {
            string siglaSistemaPermisys = ConfigurationManager.AppSettings["Permisys.SiglaSistema"];
            string siglaModuloPermisys = ConfigurationManager.AppSettings["Permisys.SiglaModulo"];

            if (string.IsNullOrWhiteSpace("Permisys.SiglaSistema") || string.IsNullOrWhiteSpace("Permisys.SiglaModulo")) {
                throw new Exception("As configurações \"Permisys.SiglaSistema\" e \"Permisys.SiglaModulo\" são obrigatórias.");
            }

            if (idUsuarioFunc == null) {
                throw new Exception("A função de obtenção do ID do usuário é obrigatória.");
            }

            int idUsuarioPermisys = idUsuarioFunc();

            List<SqlDataRecord> parametros = null;

            if (parametrosEvento != null && parametrosEvento.Count() > 0) {

                parametros = new List<SqlDataRecord>();

                SqlMetaData[] rowMetadata = new SqlMetaData[] {
                    new SqlMetaData("ORDEM", SqlDbType.Int),
                    new SqlMetaData("NOME", SqlDbType.VarChar, 20),
                    new SqlMetaData("VALOR", SqlDbType.VarChar, 100)
                };

                foreach (var parametro in parametrosEvento) {

                    if (string.IsNullOrWhiteSpace(parametro.Nome) || string.IsNullOrWhiteSpace(parametro.Valor)) {
                        throw new Exception("O \"Nome\" e \"Valor\" são obrigatórios para todos os parâmetros.");
                    }

                    SqlDataRecord row = new SqlDataRecord(rowMetadata);
                    row.SetInt32(0, parametro.Ordem);
                    row.SetString(1, parametro.Nome);
                    row.SetString(2, parametro.Valor);
                    parametros.Add(row);
                }
            }

            context.Database.ExecuteSqlCommand("LOGSYS.SP_GERAR_EVENTO_AUDITORIA @SIGLA_SISTEMA_PERMISYS, @SIGLA_MODULO_PERMISYS, @ID_USUARIO_PERMISYS, @CODIGO_TIPO_EVENTO_AUDITORIA, @PARAMETROS_EVENTO",
                new object[] {
                    new SqlParameter("SIGLA_SISTEMA_PERMISYS", SqlDbType.VarChar, 30) { Value = siglaSistemaPermisys },
                    new SqlParameter("SIGLA_MODULO_PERMISYS", SqlDbType.VarChar, 30) { Value = siglaModuloPermisys },
                    new SqlParameter("ID_USUARIO_PERMISYS", SqlDbType.Int) { Value = idUsuarioPermisys },
                    new SqlParameter("CODIGO_TIPO_EVENTO_AUDITORIA", SqlDbType.Int) { Value = codigoTipoEventoAuditoria },
                    new SqlParameter("PARAMETROS_EVENTO", SqlDbType.Structured) { TypeName = "LOGSYS.LOGSYS_LISTA_PARAMETROS", Value = parametros }
                }
            );
        }
开发者ID:baltazzar,项目名称:NETCommons,代码行数:51,代码来源:LogSysExtension.cs

示例7: AccountantPagesCounterIncrementor

        public static void AccountantPagesCounterIncrementor(string columnName)
        {
            using (SqlConnection connection = new SqlConnection(@"context connection=true"))
            {
                connection.Open();

                string txtCommand = string.Format(@"UPDATE [dbo].[AccountantPagesCounters] SET {0}=({0} + 1) WHERE Id=1;"
                    + "SELECT {0} FROM [dbo].[AccountantPagesCounters] WHERE Id=1;", columnName);

                SqlCommand cmd = new SqlCommand(txtCommand, connection);
                int sheetNumber = (int)cmd.ExecuteScalar();

                SqlMetaData sqlMetaData = new SqlMetaData("AccountantPageNumber", SqlDbType.Int);
                SqlDataRecord record = new SqlDataRecord(sqlMetaData);
                record.SetInt32(0, sheetNumber);
                SqlContext.Pipe.Send(record);
            }
        }
开发者ID:Ashna,项目名称:Shayan-Dental,代码行数:18,代码来源:AccountantPagesCounterIncrementor.cs

示例8: DeleteSurveyTokensByIdMultiple

        public void DeleteSurveyTokensByIdMultiple(IEnumerable<int> ids)
        {
            SqlMetaData[] tab = { new SqlMetaData("value", SqlDbType.Int) };
            List<SqlDataRecord> idList =
            ids.Select(x => { var y = new SqlDataRecord(tab); y.SetInt32(0, x); return y; }).ToList<SqlDataRecord>();

            SqlParameter p = new SqlParameter("@tblTokenIdList", SqlDbType.Structured);
            p.Direction = ParameterDirection.Input;
            p.TypeName = "dbo.IntTableType";
            p.Value = idList;

            SqlCommand cmd = new SqlCommand();
            using (SqlConnection conn = new SqlConnection(DbConnection.NewDbConnectionString))
            {
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "vts_spSurveyTokenDeleteMultiple";
                cmd.Parameters.Add(p);
                cmd.ExecuteNonQuery();
            }
        }
开发者ID:ChrisNelsonPE,项目名称:surveyproject_main_public,代码行数:22,代码来源:SurveyToken.cs

示例9: TSqlDataRecord

        public static IEnumerable<SqlDataRecord> TSqlDataRecord(List<NotaEntProd> listaNotaEntProd)
        {
            List<SqlDataRecord> listaSqlDataRecord = new List<SqlDataRecord>();

            foreach (NotaEntProd oNotaEntProd in listaNotaEntProd)
            {
                SqlDataRecord oSqlDataRecord = new SqlDataRecord(
                    new SqlMetaData[]{ new SqlMetaData("nProdId", SqlDbType.Int),
                                        new SqlMetaData("nDetCantidad", SqlDbType.Decimal,12,3),
                                        new SqlMetaData("nDetProdPrecioUnit", SqlDbType.Money),
                                        new SqlMetaData("nDetImporte", SqlDbType.Money)
                                    });

                oSqlDataRecord.SetInt32(0, oNotaEntProd.oProd.nProdId);
                oSqlDataRecord.SetSqlDecimal(1, oNotaEntProd.nDetCantidad);
                oSqlDataRecord.SetSqlMoney(2, oNotaEntProd.nProdPrecioUnit);
                oSqlDataRecord.SetSqlMoney(3, oNotaEntProd.nDetImporte);
                listaSqlDataRecord.Add(oSqlDataRecord);
            }

            return listaSqlDataRecord;
        }
开发者ID:AmadoDomper,项目名称:CHUYAChuya,代码行数:22,代码来源:NotaEntregaProductoCollection.cs

示例10: Shop_CalculateRefund

    public static void Shop_CalculateRefund(string StoreName, string APIKey, string Password, long OrderID, string JsonString)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        SqlPipe p = SqlContext.Pipe;

        // Create a new record with the column metadata. The constructor is
        // able to accept a variable number of parameters.
        SqlDataRecord record = new SqlDataRecord(
            new SqlMetaData[] { new SqlMetaData("ShippingAmount", SqlDbType.NVarChar,18),
            new SqlMetaData("ShippingTax", SqlDbType.NVarChar,18),
            new SqlMetaData("MaximumRefundable", SqlDbType.NVarChar,18),
            new SqlMetaData("RefundLineItems", SqlDbType.Int,4),
            new SqlMetaData("Transactions", SqlDbType.Int,4)}
            );

        Refund r = sp.CalculateRefund(OrderID, JsonString);
        // Mark the begining of the result-set.
        SqlContext.Pipe.SendResultsStart(record);
        // Set the record fields.
        record.SetString(0,r.shipping.amount);
        record.SetString(1, r.shipping.tax);
        record.SetString(2, r.shipping.maximum_refundable);
        record.SetInt32(3, r.refund_line_items.Count);
        record.SetInt32(4, r.transactions.Count);

        //record.SetInt32(1, 42);
        //record.SetDateTime(2, DateTime.Now);

        // Send the row back to the client.
        SqlContext.Pipe.SendResultsRow(record);

        // Mark the end of the result-set.
        SqlContext.Pipe.SendResultsEnd();

        // Send the record to the calling program.
        SqlContext.Pipe.Send(record);
    }
开发者ID:mpoerwito,项目名称:RestCallCLR,代码行数:37,代码来源:Procedure.cs

示例11: IR_SM_Province_PerCustomer_PerDistributor

    public static void IR_SM_Province_PerCustomer_PerDistributor(string productIds, DateTime startDate, DateTime endDate, string provinceIds, string distributorIds)
    {
        using (SqlConnection con = new SqlConnection("context connection=true"))
        {
            SqlPipe pipe = SqlContext.Pipe;
            List<SqlCommand> commands = new List<SqlCommand>();
            try
            {
                List<string> prodIds = new List<string>();
                string[] split2 = productIds.Split('-');
                foreach (string s in split2)
                    if (s.ToLower().Trim() != "")
                        prodIds.Add(s.Trim().ToLower());

                List<string> provIds = new List<string>();
                string[] split = provinceIds.Split('-');
                foreach (string s in split)
                    if (s.ToLower().Trim() != "")
                        provIds.Add(s.Trim().ToLower());

                if (distributorIds != "")
                {
                    List<string> distIdsList = new List<string>();
                    string[] splited_distIds = distributorIds.Split('-');
                    foreach (string distCode in splited_distIds)
                        if (distCode.ToLower().Trim() != "")
                            distIdsList.Add(distCode.Trim().ToLower());

                    foreach (string distId in distIdsList)
                    {
                        foreach (string provId in provIds)
                        {
                            foreach (string proId in prodIds)
                            {
                                commands.Add(new SqlCommand("select [Sales].[DS].[DSID], [Sales].[DS].[DSName],[Global].[Products].[ProductID], [Sales].[DSSales].[SalesQty], [Sales].[DSSales].[CheckGDate] ,[Global].[City].[ProvinceID], [Global].[Distributors].[DistID], [Global].[Distributors].[DistNameEnglish] from [Sales].[DS] inner join [Sales].[DSSales] on [Sales].[DS].[DSID] = [Sales].[DSSales].[DSID] inner join [Global].[Products] on [Global].[Products].[ProductID] = [Sales].[DSSales].[ProductID] inner join [Global].[City] on [Global].[City].[CityID] = [Sales].[DS].[DSCityID] inner join [Global].[Distributors] on [Global].[Distributors].[DistID] = [Sales].[DSSales].[DistID] where [Sales].[DSSales].[CheckGDate] between @startdate and @enddate and [Global].[Products].[ProductID] = @productid and [Global].[City].[ProvinceID] = @provinceid and [Global].[Distributors].[DistID] = @distid"));
                                commands[commands.Count - 1].Parameters.AddWithValue("@productid", proId);
                                commands[commands.Count - 1].Parameters.AddWithValue("@startdate", startDate);
                                commands[commands.Count - 1].Parameters.AddWithValue("@enddate", endDate);
                                commands[commands.Count - 1].Parameters.AddWithValue("@provinceid", provId);
                                commands[commands.Count - 1].Parameters.AddWithValue("@distid", distId);
                            }
                        }
                    }
                }
                else
                {
                    foreach (string provId in provIds)
                    {
                        foreach (string proId in prodIds)
                        {
                            commands.Add(new SqlCommand("select [Sales].[DS].[DSID], [Sales].[DS].[DSName],[Global].[Products].[ProductID], [Sales].[DSSales].[SalesQty], [Sales].[DSSales].[CheckGDate] ,[Global].[City].[ProvinceID], [Global].[Distributors].[DistID], [Global].[Distributors].[DistNameEnglish] from [Sales].[DS] inner join [Sales].[DSSales] on [Sales].[DS].[DSID] = [Sales].[DSSales].[DSID] inner join [Global].[Products] on [Global].[Products].[ProductID] = [Sales].[DSSales].[ProductID] inner join [Global].[City] on [Global].[City].[CityID] = [Sales].[DS].[DSCityID] inner join [Global].[Distributors] on [Global].[Distributors].[DistID] = [Sales].[DSSales].[DistID] where [Sales].[DSSales].[CheckGDate] between @startdate and @enddate and [Global].[Products].[ProductID] = @productid and [Global].[City].[ProvinceID] = @provinceid"));
                            commands[commands.Count - 1].Parameters.AddWithValue("@productid", proId);
                            commands[commands.Count - 1].Parameters.AddWithValue("@startdate", startDate);
                            commands[commands.Count - 1].Parameters.AddWithValue("@enddate", endDate);
                            commands[commands.Count - 1].Parameters.AddWithValue("@provinceid", provId);
                        }
                    }
                }

                SqlDataRecord record = new SqlDataRecord(new SqlMetaData("DSID", SqlDbType.Int),
                        new SqlMetaData("DSName", SqlDbType.NVarChar, 255, 1033, SqlCompareOptions.None),
                        new SqlMetaData("ProductID", SqlDbType.Int),
                        new SqlMetaData("SalesQty", SqlDbType.Int),
                        new SqlMetaData("CheckGDate", SqlDbType.DateTime),
                        new SqlMetaData("ProvinceID", SqlDbType.Int),
                        new SqlMetaData("DistID", SqlDbType.Int),
                        new SqlMetaData("DistNameEnglish", SqlDbType.NVarChar, 255, 1033, SqlCompareOptions.None));

                pipe.SendResultsStart(record);
                foreach (SqlCommand cmd in commands)
                {
                    try
                    {
                        cmd.Connection = con;
                        con.Open();

                        SqlDataReader reader = cmd.ExecuteReader();
                        while (reader.Read())
                        {
                            int DSID = Convert.ToInt32(reader["DSID"]);
                            string DSName = Convert.ToString(reader["DSName"]);
                            int ProductID = Convert.ToInt32(reader["ProductID"]);
                            int SalesQty = Convert.ToInt32(reader["SalesQty"]);
                            DateTime CheckGDate = Convert.ToDateTime(reader["CheckGDate"]);
                            int ProvinceID = Convert.ToInt32(reader["ProvinceID"]);
                            int DistID = Convert.ToInt32(reader["DistID"]);
                            string DistName = Convert.ToString(reader["DistNameEnglish"]);

                            record.SetInt32(0, DSID);
                            record.SetString(1, DSName);
                            record.SetInt32(2, ProductID);
                            record.SetInt32(3, SalesQty);
                            record.SetDateTime(4, CheckGDate);
                            record.SetInt32(5, ProvinceID);
                            record.SetInt32(6, DistID);
                            record.SetString(7, DistName);
                            pipe.SendResultsRow(record);
                        }
                    }
                    catch (Exception ex)
//.........这里部分代码省略.........
开发者ID:naimheshmati,项目名称:Sanofi,代码行数:101,代码来源:IR_SM_Province_PerCustomer_PerDistributor.cs

示例12: IR_SM_DataRange

    public static void IR_SM_DataRange()
    {
        using (SqlConnection con = new SqlConnection("context connection=true"))
        {
            SqlPipe pipe = SqlContext.Pipe;
            List<SqlCommand> commands = new List<SqlCommand>();
            commands.Add(new SqlCommand("SELECT distinct DATEPART(MONTH, [CD].[Sales].[DSSales].[CheckGDate]) as MonthT, DATEPART(YEAR, [CD].[Sales].[DSSales].[CheckGDate]) as YearT FROM [CD].[Sales].[DSSales] order by YearT, MonthT"));

            SqlDataRecord record = new SqlDataRecord(new SqlMetaData("MonthT", SqlDbType.Int),
                    new SqlMetaData("YearT", SqlDbType.Int));

            pipe.SendResultsStart(record);
            foreach (SqlCommand cmd in commands)
            {
                try
                {
                    cmd.Connection = con;
                    con.Open();

                    SqlDataReader dr = cmd.ExecuteReader();
                    bool firstRowSent = false;
                    int month = 1;
                    int year = 1;
                    while (dr.Read())
                    {
                        try
                        {
                            month = Convert.ToInt32(dr["montht"]);
                            year = Convert.ToInt32(dr["yeart"]);

                            if (!firstRowSent)
                            {
                                record.SetInt32(0, month);
                                record.SetInt32(1, year);

                                pipe.SendResultsRow(record);
                                firstRowSent = true;
                            }
                        }
                        catch (Exception ex)
                        {
                            ex.ToString();
                        }
                    }
                    record.SetInt32(0, month);
                    record.SetInt32(1, year);

                    pipe.SendResultsRow(record);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (con != null)
                        con.Close();
                }
            }
            pipe.SendResultsEnd();
        }
    }
开发者ID:naimheshmati,项目名称:Sanofi,代码行数:62,代码来源:IR_SM_DataRange.cs

示例13: adm_list_status_SelectedIndexChanged

        protected void adm_list_status_SelectedIndexChanged(object sender, EventArgs e)
        {
            int size = 0;
            for (int listcount = 0; listcount < (adm_list_status.Items.Count); listcount++)
            {
                if (adm_list_status.Items[listcount].Selected == true)
                {
                    size = size + 1;
                }
            }
            int[] status = new int[size];
            List<SqlDataRecord> lista_status = new List<SqlDataRecord>();
            SqlMetaData[] definicao = { new SqlMetaData("n", SqlDbType.Int) };

            int count = 0;

            for (int listcount = 0; listcount < (adm_list_status.Items.Count); listcount++)
            {

                if (adm_list_status.Items[listcount].Selected == true)
                {
                    status[count] = int.Parse(adm_list_status.Items[listcount].Value);
                    count++;
                }
            }
            foreach (int id in status)
            {
                SqlDataRecord rec = new SqlDataRecord(definicao);
                rec.SetInt32(0, id);
                lista_status.Add(rec);
            }

            string cstr = conexao;
            using (SqlConnection con = new SqlConnection(cstr))
            {
                con.Open();
                SqlCommand com = new SqlCommand("sp_vw_relat_substatus2", con);
                com.CommandType = CommandType.StoredProcedure;

                com.Parameters.Add("@status", SqlDbType.Structured);
                com.Parameters["@status"].Direction = ParameterDirection.Input;
                com.Parameters["@status"].TypeName = "int_list";
                com.Parameters["@status"].Value = lista_status;

                using (SqlDataAdapter da = new SqlDataAdapter(com))
                using (DataSet ds = new DataSet())
                {
                    da.Fill(ds);
                    adm_list_substatus.DataSource = ds;
                    adm_list_substatus.DataBind();
                }
            }
        }
开发者ID:diegohss,项目名称:KIVAH,代码行数:53,代码来源:Administrativo.aspx.cs

示例14: adm_button_relatorio_Click

        protected void adm_button_relatorio_Click(object sender, EventArgs e)
        {
            int size = 0;
            List<SqlDataRecord> lista_status = new List<SqlDataRecord>();
            List<SqlDataRecord> lista_substatus = new List<SqlDataRecord>();
            List<SqlDataRecord> lista_projetos = new List<SqlDataRecord>();
            List<SqlDataRecord> lista_empresas = new List<SqlDataRecord>();
            SqlMetaData[] definicao = { new SqlMetaData("n", SqlDbType.Int) };
            int count = 0;

            //CONTAGEM DE LINHAS SELECIONADAS NO LISTBOX DE STATUS
            for (int listcount = 0; listcount < (adm_list_status.Items.Count); listcount++)
            {
                if (adm_list_status.Items[listcount].Selected == true)
                {
                    size = size + 1;
                }
            }

            int[] status = new int[size];

            int verifica_status = 0;
            //PREENCHIMENTO DO ARRAY QUE CONTEM OS IDS DAS LINHAS SELECIONADAS NO LISTBOX DE STATUS
            for (int listcount = 0; listcount < (adm_list_status.Items.Count); listcount++)
            {
                if (adm_list_status.Items[listcount].Selected == true)
                {
                    verifica_status = 1;
                    status[count] = int.Parse(adm_list_status.Items[listcount].Value);
                    count++;
                }
            }

            //POPULANDO O PARAMETRO PARA ENVIAR À PROCEDURE COM OS DADOS
            foreach (int id in status)
            {
                SqlDataRecord rec = new SqlDataRecord(definicao);
                rec.SetInt32(0, id);
                lista_status.Add(rec);
            }

            size = 0;
            count = 0;

            //CONTAGEM DE LINHAS SELECIONADAS NO LISTBOX DE PROJETOS
            for (int listcount = 0; listcount < (adm_list_projetos.Items.Count); listcount++)
            {
                if (adm_list_projetos.Items[listcount].Selected == true)
                {
                    size = size + 1;
                }
            }

            int[] projetos = new int[size];

            int verifica_projetos = 0;
            //PREENCHIMENTO DO ARRAY QUE CONTEM OS IDS DAS LINHAS SELECIONADAS NO LISTBOX DE PROJETOS
            for (int listcount = 0; listcount < (adm_list_projetos.Items.Count); listcount++)
            {
                if (adm_list_projetos.Items[listcount].Selected == true)
                {
                    verifica_projetos = 1;
                    projetos[count] = int.Parse(adm_list_projetos.Items[listcount].Value);
                    count++;
                }
            }

            //POPULANDO O PARAMETRO PARA ENVIAR À PROCEDURE COM OS DADOS
            foreach (int id in projetos)
            {
                SqlDataRecord rec = new SqlDataRecord(definicao);
                rec.SetInt32(0, id);
                lista_projetos.Add(rec);
            }

            size = 0;
            count = 0;

            //CONTAGEM DE LINHAS SELECIONADAS NO LISTBOX DE SUBSTATUS
            for (int listcount = 0; listcount < (adm_list_substatus.Items.Count); listcount++)
            {
                if (adm_list_substatus.Items[listcount].Selected == true)
                {
                    size = size + 1;
                }
            }

            int[] substatus = new int[size];

            int verifica_substatus = 0;
            //PREENCHIMENTO DO ARRAY QUE CONTEM OS IDS DAS LINHAS SELECIONADAS NO LISTBOX DE SUBSTATUS
            for (int listcount = 0; listcount < (adm_list_substatus.Items.Count); listcount++)
            {
                if (adm_list_substatus.Items[listcount].Selected == true)
                {
                    verifica_substatus = 1;
                    substatus[count] = int.Parse(adm_list_substatus.Items[listcount].Value);
                    count++;
                }
            }
//.........这里部分代码省略.........
开发者ID:diegohss,项目名称:KIVAH,代码行数:101,代码来源:Administrativo.aspx.cs

示例15: SetValue

 public void SetValue(ref SqlDataRecord sqlDataRecord, SqlDescriptionAttribute sqlDescription, object value,
                      int ordinal)
 {
     if (!sqlDescription.HasDbType)
     {
         throw new InvalidDataException("SqlDbType can not be null");
     }
     if (value == null)
     {
         sqlDataRecord.SetDBNull(ordinal);
         return;
     }
     switch (sqlDescription.SqlDbType)
     {
         case SqlDbType.BigInt:
             var ll = value as long?;
             if (!ll.HasValue)
             {
                 throw new Exception("Value is not BigInt");
             }
             sqlDataRecord.SetInt64(ordinal, ll.Value);
             break;
         case SqlDbType.Binary:
             var bb = value as byte?;
             if (!bb.HasValue)
             {
                 throw new Exception("Value is not BigInt");
             }
             sqlDataRecord.SetSqlByte(ordinal, bb.Value);
             break;
         case SqlDbType.Bit:
             var bit = value as bool?;
             if (!bit.HasValue)
             {
                 throw new Exception("Value is not Bit");
             }
             sqlDataRecord.SetBoolean(ordinal, bit.Value);
             break;
         case SqlDbType.NChar:
         case SqlDbType.Char:
             var chr = value as char?;
             if (!chr.HasValue)
             {
                 throw new Exception("Value is not Char");
             }
             sqlDataRecord.SetChar(ordinal, chr.Value);
             break;
         case SqlDbType.DateTime:
         case SqlDbType.SmallDateTime:
         case SqlDbType.Date:
         case SqlDbType.DateTime2:
             var dt = value as DateTime?;
             if (!dt.HasValue)
             {
                 throw new Exception("Value is not DateTime");
             }
             sqlDataRecord.SetDateTime(ordinal, dt.Value);
             break;
         case SqlDbType.Decimal:
         case SqlDbType.Money:
         case SqlDbType.SmallMoney:
             var dc = value as decimal?;
             if (!dc.HasValue)
             {
                 throw new Exception("Value is not Decimal");
             }
             sqlDataRecord.SetDecimal(ordinal, dc.Value);
             break;
         case SqlDbType.Float:
             var d = value as double?;
             if (!d.HasValue)
             {
                 throw new Exception("Value is not Double");
             }
             sqlDataRecord.SetDouble(ordinal, d.Value);
             break;
         case SqlDbType.Image:
         case SqlDbType.VarBinary:
             var bytes = value as byte[];
             if (bytes == null)
             {
                 throw new Exception("Value is not byte array");
             }
             sqlDataRecord.SetBytes(ordinal, 0, bytes, 0, bytes.Length);
             break;
         case SqlDbType.Int:
             var integer = value as int?;
             if (integer == null)
             {
                 var ushortValue = (value as ushort?);
                 if (ushortValue == null)
                 {
                     throw new Exception("Value is not int or ushort");
                 }
                 integer = ushortValue.Value;
             }
             sqlDataRecord.SetInt32(ordinal, integer.Value);
             break;
         case SqlDbType.NText:
         case SqlDbType.NVarChar:
//.........这里部分代码省略.........
开发者ID:riberk,项目名称:CommonCC,代码行数:101,代码来源:SqlRecordSetValue.cs


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