Posts

Showing posts from 2017

Differences Between Bootstrap 3 & 4

Component Bootstrap 3 Bootstrap 4 Global Source CSS Files LESS SCSS Primary CSS Unit px rem Media Queries Unit px px Global Font Size 14px 16px Default Fonts Helvetica Neue, Helvetica, Arial, sans-serif Uses a "native font stack" (user's system fonts), with a fallback to Helvetica Neue, Arial, and sans-serif Grids Grid Tiers 4 tier grid system (xs, sm, md, lg) 5 tier grid system (xs, sm, md, lg, xl). Bootstrap 4 has removed the xs from the lowest break point. Therefore, col-* covers all devices (no need to specify the size in this case). Offsetting Columns Uses col-*-offset-* classes to offset co...

Variable Declaration and If Condition in Sql Server Stored Procedure

Create Proc Usp_CheckStatus @id int As Begin Declare @status nvarchar(50) Set @status=(select status from TblUsers where id=@id)    If(@status='active')    Begin ---Your Block of Code/query   End End

Date Diffrence in Sql Server

SELECT DATEDIFF ( DAY , GETDATE (), GETDATE () + 1 ) AS DayDiff SELECT DATEDIFF ( MINUTE , GETDATE (), GETDATE () + 1 ) AS MinuteDiff SELECT DATEDIFF ( SECOND , GETDATE (), GETDATE () + 1 ) AS SecondDiff SELECT DATEDIFF ( WEEK , GETDATE (), GETDATE () + 1 ) AS WeekDiff SELECT DATEDIFF ( HOUR , GETDATE (), GETDATE () + 1 ) AS HourDiff

GET NEXT Months of Todays Date in sql

Next Month (select dateadd(m, 1, DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0))) Next Month  + 1 (select dateadd(m, 2, DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)))

Return Image from Generic Handler that stored in Sql Server Database Varbinary Database Asp.Net C#

<%@ WebHandler Language="C#" Class="GalleryImg" %> using System; using System.Web; using System.Data; using System.Data.SqlClient; using System.IO; using System.Configuration; public class GalleryImg : IHttpHandler {     public void ProcessRequest(HttpContext context)     {         int id;         if (context.Request.QueryString["id"] != null || context.Request.QueryString["id"] != "")         {             id = Convert.ToInt32(context.Request.QueryString["id"]);             context.Response.ContentType = "image/jpeg";             Stream strm = DisplayImage(id);             byte[] buffer = new byte[2048];     ...

Save Image to SQL Server using varbinary,varbinary(Max) datatype

cn.Open(); SqlCommand cmd = new SqlCommand("Usp_InsertEvent", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("Event_Name",TxtTitle.Text); cmd.Parameters.AddWithValue("Event_Description",TxtDescription.Text); Byte[] image1 = null; if (FileUpload1.HasFile && FileUpload1.PostedFile != null) {     HttpPostedFile File = FileUpload1.PostedFile;     image1 = new Byte[File.ContentLength];     File.InputStream.Read(image1, 0, File.ContentLength);     cmd.Parameters.AddWithValue("Image", image1); } else {     cmd.Parameters.Add("Photo1", SqlDbType.VarBinary).Value=DBNull.Value; } int x=cmd.ExecuteNonQuery(); cn.Close();
States in India Dropdown list ASP.Net < asp:DropDownList ID =" State" runat =" server" > < asp:ListItem > Andaman and Nicobar Islands < / asp:ListItem > < asp:ListItem > Andhra Pradesh < / asp:ListItem > < asp:ListItem > Arunachal Pradesh < / asp:ListItem > < asp:ListItem > Assam < / asp:ListItem > < asp:ListItem > Bihar < / asp:ListItem > < asp:ListItem > Chandigarh < / asp:ListItem > < asp:ListItem > Chattisgarh < / asp:ListItem > < asp:ListItem > Dadra and Nagar Haveli < / asp:ListItem > < asp:ListItem > Daman and Diu < / asp:ListItem > < asp:ListItem > Delhi < / asp:ListItem > < asp:ListItem > Goa < / asp:ListItem > < asp:ListItem > Gujarat < / asp:ListItem > < asp:ListItem > Haryana ...

Create HTML Report for C# Windows Form : Best Alternative to Crystal Report for Receipt Printing

Create HTML Markup and store to string variable : string part1 = "<!DOCTYPE html><html><head><style>table {border-collapse: collapse;}table, td, th {border: 1px solid black;}</style></head><body style='font-family:cambria;font-size:12px'><div  style='border-style:solid;border-width:1px;height:400px;text-align:center'><header style='bottom-border-style:solid;bottom-border-width:1px;bottom-border-color:#333'><span style='font-size:25px'>"; string part2 = CompanyName + "<br></span>";                 string part3 = CompanyAddress + "<hr style='color:#333'></header><div><table><tr ><td><b>INVOICE</b></td><td>" + InvoiceNo + "</td><td> <label style='padding-right:5%'><b>DATE</b></label></td><td><label style='paddin...
Asp.net c# code to Render Gridview Control   public override void VerifyRenderingInServerForm(Control control)     {         /* Verifies that the control is rendered */     } protected void BtnPayment_Click(object sender, EventArgs e)     {  using (StringWriter sw = new StringWriter())             {                 using (HtmlTextWriter hw = new HtmlTextWriter(sw))                 {                     GridViewCart.RenderControl(hw);                     StringReader sr = new StringReader(sw.ToString());                     string tablehtml = "GridView:<hr />" + sw.ToString();                 }     ...

Case in SQL

CASE ebv.db_no WHEN 22978 THEN 'WECS 9500' WHEN 23218 THEN 'WECS 9500' WHEN 23219 THEN 'WECS 9500' ELSE 'WECS 9520' END

Uploading Image to Sql Server Image Datatype in asp.net using fileupload Control

Uploading Image to Sql Server Image Datatype in asp.net using fileupload Control  Byte[] imgbyte = null;  if (FileUpload1.HasFile)             {                 string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);                 FileUpload1.PostedFile.SaveAs(Server.MapPath("~/UserPhoto/") + DateTime.Now.ToString("_MMddyyyy_HHmmss") + fileName);                 photo = "UserPhoto/" + DateTime.Now.ToString("_MMddyyyy_HHmmss") + fileName;                 string fpathPhoto = Server.MapPath(photo);                 FileInfo fInfo = new FileInfo(fpathPhoto);                 long numBytes = fInfo.Length;                 //Open FileStream to read...