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


C# Connection.getConnectionString方法代码示例

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


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

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Menu menu = Master.FindControl("NavigationMenu") as Menu;
                menu.Items[2].ChildItems[0].ChildItems.RemoveAt(1);

                if (Session.Contents["rol"].ToString().Equals("DSTADM"))
                    Response.Redirect("../Default.aspx");

                Connection conexion = new Connection();
                string query = String.Empty;

                SqlDataSource1.ConnectionString = conexion.getConnectionString();

                if (Session.Contents["rol"].ToString().Equals("KCPADM"))
                    query = String.Format("SELECT USER_ID, USER_NAME, STATUS, E_MAIL FROM USUARIOS AS U WHERE USER_ID <> '{0}' AND ID_COUNTRY = '{1}' AND 0 = (SELECT count(Kam.KAM_NAME) from Kam where Kam.KAM_ID = U.USER_ID AND Kam.KAM_ACTIVE = 1)",
                        Session.Contents["userid"].ToString(), conexion.getUserCountry(Session.Contents["userid"].ToString()));
                else if (Session.Contents["rol"].ToString().Equals("KCPCCR"))
                    query = String.Format("SELECT USER_ID, USER_NAME, STATUS, E_MAIL FROM USUARIOS WHERE USER_ID <> '{0}' AND ID_COUNTRY = '{1}' AND (ID_ROL <> 'KCPADM' AND ID_ROL <> 'KCPCCR')",
                        Session.Contents["userid"].ToString(), conexion.getUserCountry(Session.Contents["userid"].ToString()));

                SqlDataSource1.SelectCommand = query;
                SqlDataSource1.ConflictDetection = ConflictOptions.CompareAllValues;
            }
            catch (Exception error)
            {
                RadAjaxManager1.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
            }
        }
开发者ID:Eliazar,项目名称:Dispenser_Tracking,代码行数:30,代码来源:Editar_Usuario.aspx.cs

示例2: cargarDataSources

        private void cargarDataSources()
        {
            try
            {
                Connection conexion = new Connection();
                sqlEstadoCiudad.ConnectionString = conexion.getConnectionString();
                sqlEstadoCiudad.SelectCommand = String.Format("SELECT DIVISION_NAME, CITY_NAME FROM DIVISION_TERRITORIAL WHERE COUNTRY_ID = '{0}';", conexion.getUserCountry(Session.Contents["userid"].ToString()));

                sqlSegmentos.ConnectionString = conexion.getConnectionString();
                sqlSegmentos.SelectCommand = String.Format("SELECT SUB_SEGMENT_ID, SUB_SEGMENT_NAME FROM SUB_SEGMENTOS WHERE SUB_SEGMENT_ID <> 0 ORDER BY SUB_SEGMENT_ID ASC;");

                sqlDispensadorProducto.ConnectionString = conexion.getConnectionString();
                sqlDispensadorProducto.SelectCommand = String.Format("SELECT D.ID_DISPENSER, D.DESCRIPTION, D.DISPENSER_FACE FROM DISPENSADORES AS D JOIN DISPENSADOR_PAIS AS DP ON DP.DISPENSER_ID = D.ID_DISPENSER WHERE DP.COUNTRY_ID = '{0}' AND DP.DISPENSER_STATUS = 1 ORDER BY D.ID_DISPENSER ASC;",
                    conexion.getUserCountry(Session.Contents["userid"].ToString()));
            }
            catch (Exception error)
            {
                radajaxmanager.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
            }
        }
开发者ID:Eliazar,项目名称:Dispenser_Tracking,代码行数:20,代码来源:AutorizacionSolicitudes.aspx.cs

示例3: cargarProducto

        private void cargarProducto(string dispenserID)
        {
            try
            {
                Connection conexion = new Connection();
                cmbProducto.EmptyMessage = "Seleccione un producto";
                cmbProducto.Items.Clear();

                string userCountry = conexion.getUserCountry(Session["userid"].ToString());

                string query = String.Format("SELECT PRODUCT_ID, PRODUCT_DESCRIP FROM PRODUCTOS WHERE DISPENSER_ID = '{0}' AND COUNTRY_ID = '{1}'", dispenserID, userCountry);

                try
                {
                    SqlConnection bridge = new SqlConnection(conexion.getConnectionString());
                    SqlDataAdapter adapter = new SqlDataAdapter(query, bridge);
                    DataTable datatable = new DataTable();
                    adapter.Fill(datatable);

                    foreach (DataRow datarow in datatable.Rows)
                    {
                        RadComboBoxItem item = new RadComboBoxItem();
                        item.Text = datarow["PRODUCT_ID"].ToString() + " " + datarow["PRODUCT_DESCRIP"].ToString();
                        item.Value = datarow["PRODUCT_ID"].ToString();

                        cmbProducto.Items.Add(item);
                        item.DataBind();
                    }
                }
                catch (SqlException)
                {
                    radajaxmanager.ResponseScripts.Add(@"alert('Error inesperado de conexion, no se logro cargar la lista de productos refresque la pagina" +
                        " o intentelo mas tarde.');");
                    return;
                }
            }
            catch (Exception error)
            {
                radajaxmanager.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
            }
        }
开发者ID:Eliazar,项目名称:Dispenser_Tracking,代码行数:41,代码来源:AutorizacionSolicitudes.aspx.cs

示例4: setDataSources

        protected void setDataSources()
        {
            Connection conexion = new Connection();

            sqlCiudad.ConnectionString = conexion.getConnectionString();
            sqlCiudad.SelectCommand = String.Format("SELECT DIVISION_NAME, CITY_NAME FROM DIVISION_TERRITORIAL WHERE COUNTRY_ID = '{0}'", conexion.getUserCountry(Session.Contents["userid"].ToString()));

            sqlMotivos.ConnectionString = conexion.getConnectionString();
            sqlMotivos.SelectCommand = String.Format("SELECT ID_REASON, REASON_DESCRIP FROM RAZONES WHERE ID_REASON <> 3");

            sqlClientes.ConnectionString = conexion.getConnectionString();
            string clientid = conexion.getUsersInfo("CLIENT_ID", "USER_ID", Session["userid"].ToString());
            sqlClientes.SelectCommand = String.Format("SELECT END_USER_ID, TRADE_NAME FROM CLIENTES_FINALES WHERE CLIENT_ID = '{0}' AND CLIENT_STATUS = 1", clientid);

            sqlVendedores.ConnectionString = conexion.getConnectionString();
            sqlVendedores.SelectCommand = String.Format("SELECT SALES_ID, SALES_NAME FROM VENDEDORES WHERE CLIENT_ID = '{0}'", clientid);

            sqlSegmento.ConnectionString = conexion.getConnectionString();
            sqlSegmento.SelectCommand = String.Format("SELECT SUB_SEGMENT_ID, SUB_SEGMENT_NAME FROM SUB_SEGMENTOS WHERE SUB_SEGMENT_ID <> 0 ORDER BY SUB_SEGMENT_ID ASC");

            sqlCondicionesPago.ConnectionString = conexion.getConnectionString();
            sqlCondicionesPago.SelectCommand = String.Format("SELECT ID_PAYMENT_CONDITION, PAYMENT_CONDITION FROM CONDICIONES_PAGO");
        }
开发者ID:Eliazar,项目名称:Dispenser_Tracking,代码行数:23,代码来源:Solicitud_Dispensadores.aspx.cs


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