Skip to main content

Posts

Showing posts from May, 2014

Custom calendar in asp.net

<form id="form1" runat="server">     <div>         <asp:DropDownList ID="ddlMonth" runat="server" OnSelectedIndexChanged="ddlMonth_SelectedIndexChanged"             AutoPostBack="true">             <asp:ListItem Text="Jan" Value="1"></asp:ListItem>             <asp:ListItem Text="Feb" Value="2"></asp:ListItem>             <asp:ListItem Text="Mar" Value="3"></asp:ListItem>             <asp:ListItem Text="Apr" Value="4"></asp:ListItem>             <asp:ListItem Text="May" Value="5"></asp:ListItem>             <asp:ListItem Text="Jun" Value="6"></asp:ListItem>             <asp:ListItem Text="Jul" Value="7"></asp:ListItem>             <asp:ListItem Text="Aug" Value="7"&

Database Connection using SqlConnection, SqlCommand , SqlDataAdapter

SqlConnection cn = null ; SqlCommand cmd = null ; SqlDataAdapter da = null ; //string cs = @"Data Source=(LocalDB)\v11.0;AttachDbFilename='|DataDirectory|ExperimentData.mdf';Integrated Security=True"; string cs = @"Data Source=PC-154\SQLEXPRESS;Initial Catalog=AdminPanel;Integrated Security=True" ; protected void Page_Load( object sender, EventArgs e) { Connection(); Insert(); GetAllUsers(); } private void Connection() { try { cn = new SqlConnection (cs); cn.Open(); } catch ( Exception ex) { throw ex; } } private void Insert() { Connection(); cmd = new SqlCommand (); cmd.Connection = cn; cmd.CommandType = CommandType .StoredProcedure; cmd.CommandText = "PI_Users" ; cmd.Parameters.AddWithValue( "Name" , "Brijesh" ); cmd.ExecuteNonQuery(); } private void GetAllUsers() { Connection(); cmd = new SqlCommand (); cmd.Connection

Paging Through Large Amounts of Data Using SQL Query with searching and sorting

Paging Through Large Amounts of Data Using SQL Query with searching and sorting CREATE TABLE USE [AdminPanel] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo] . [AdminUser] (       [AdminID] [int] IDENTITY ( 1 , 1 ) NOT NULL,       [EmailAddress] [varchar] ( 100 ) NULL,       [Password] [varchar] ( 50 ) NULL,       [FirstName] [varchar] ( 50 ) NULL,       [LastName] [varchar] ( 50 ) NULL,       [CreatedOn] [datetime] NULL,       [CreatedBy] [int] NULL,       [ModifiedOn] [datetime] NULL,       [ModifiedBy] [int] NULL,       [IsStatus] [int] NULL,   CONSTRAINT [PK_AdminUser] PRIMARY KEY CLUSTERED (       [AdminID] ASC ) WITH ( PAD_INDEX   = OFF , STATISTICS_NORECOMPUTE   = OFF , IGNORE_DUP_KEY = OFF , ALLOW_ROW_LOCKS   = ON , ALLOW_PAGE_LOCKS   = ON ) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO SQL Pagging Query