What is GemBox.Spreadsheet

GemBox.Spreadsheet is an easy to use .NET component that enables us perform different operations with spreadsheet files such as reading, writing, editing, converting and printing from the .NET applications using one simple API. GemBox.Spreadsheet is a fast and reliable component.

Stored procedure to fill data that needs to be populated in dropdownlist in MVC Application

STORED PROCEDURE USE [DB_obj] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[sp_FillUserRoles] -- Add the parameters for the stored procedure here AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT * from... Continue Reading →

Populate dropdown list based on data retrieved from database in MVC Application (Controller and BLL)

Controller public JsonResult FillRoles() { return Json(BLLFile.FillUserRoles(), JsonRequestBehavior.AllowGet); } Code in BLL file public static List<sp_FillUserRoles_Result> FillUserRoles() { using (Db_obj db = new Db_obj()) { return db.sp_FillUserRoles().ToList(); } } Explanation Now, Understand the sequence: View will ask controller to send data.FillRoles() Method in controller will request data from BLL file so it will give call... Continue Reading →

Populate dropdown list based on data retrieved from database in MVC Application (VIEW)

View jquery function getRelation() { $.ajax ({ url: "@(Url.Action("FillRoles", "Roles"))", data: {}, success: function (result) { var html = ""; html += "<option>Select</option>"; for (var i = 0; i < result.length; i++) { html += "<option value=" + result[i].ID + ">" + result[i].Description + "</option>"; } $("#ddlAddRoles").html(html); } }); } html <div class="col-sm-4 tb-font"> <form>... Continue Reading →

Pass data from view to controller in JSON format- MVC Application

View jquery function Save() { $.ajax ({ url: "@(Url.Action("SaveMember", "Members"))", data: { name: $("#MemberName").val(),designation: $("#ddlDesignation option:selected").val() }, contentType: "application/json; charset=utf-8", type: 'GET', dataType: "json", success: function (result) { alert("Record saved successfully."); }, error: function () { alert("Something went wrong, please try again"); } }); } html <div class="col-sm-4 tb-font"> @Html.Label("name", "Member Name", new { style... Continue Reading →

Print.js- A tiny JavaScript library

Button to Print as PDF <button type="button" onclick="printJS('docs/printjs.pdf')"> Print PDF </button> Button To print large PDF files <button type="button" onclick="printJS({printable:'docs/xx_large_printjs.pdf', type:'pdf', showModal:true})"> Print PDF with Message </button> Button to Print base64 PDF <button type="button" onclick="printJS({printable: base64, type: 'pdf', base64: true})"> Print PDF with Message </button>

Uplaod File HTML

HTML <form action="#"> <label class="col-form-label">Display Picture <span class="text-danger">*</span></label> <input type="file" id="Picfile" name="pic" class="form-control"> </form> Explanation This will allow user to upload file as the input type is file.

Select data from multiple tables and use aliases

code SELECT p.*, c.ID, c.Description as CategoryName FROM Products p, Categories c where p.CategoryID=c.ID Explanation This will select everything from products table and only 'ID' and 'Description' from categories table given the category IDs are same. Note that the alias for 'Products' table is p and Alias for 'Categories' table is c. Column 'Description' of... Continue Reading →

SQL Update

Code UPDATE Math_Results SET Marks=80 WHERE marks=79; EXPLANATION This update query will update the table Math_Results and set the marks of all students to 80 who secured 79 marks.

USE of COALESCE in a Stored Procedure MySQL

use of coalesce USE [DB_Name] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[sp_FillMarks] @studentId bigint AS BEGIN SET NOCOUNT ON; SELECT ID, Name, Marks FROM t_Results r where STUDENTID = COALESCE(NULLIF(@studentId, '0'), STUDENTID) and Marks >= 80 END Explanation This will select details of student whose id is passed to the... Continue Reading →

Blog at WordPress.com.

Up ↑

Create your website at WordPress.com
Get started