Skip to main content

Posts

Showing posts from 2013

sql get month & year from date

SELECT OTDate as Date ,CONVERT(CHAR(4), OTDate, 100) as Month ,CONVERT(CHAR(4), OTDate, 120)as Year FROM Payroll_tblEmployeeOTHour

SQL Query Execution time of you in SQL Management Studio

You can check the Execution time of you SQL Query in SQL Management Studio. like this It is very simple that you just put your SQL Query in to the Estimated time execution query DECLARE @StartTime datetime DECLARE @EndTime datetime SELECT @StartTime=GETDATE() -- Write Your Query SELECT @EndTime=GETDATE() --This will return execution time of your query SELECT DATEDIFF(NS,@StartTime,@EndTime) AS [Duration in millisecs]

how replace null to 0 in sql query

If you want to replace the null value in 0 in your sql query like the output: you have to just write as  ISNULL(DC_Requisition.MainStockID,0) as MainStockId

How to disable specific grid column in kendo ui Grid on inline editing

If you want to stop editing on specific Grid column in Kendo Ui grid like this Just use theDataAnnotations [ Editable ( false )] in your custom class for the grid i am just share my code for your help using System; using System . Collections . Generic; using System . ComponentModel . DataAnnotations; using System . Linq; using System . Web; namespace FEWO . ViewModel { public class Limitation { public long Id { get; set; } public int? LFDNR { get; set; } public Guid? ob_guid { get; set; } public DateTime? von { get; set; } public DateTime? bis { get; set; } public string einschrank { get; set; } public string wtagvon { get; set; } public string wtagbis { get; set; } public int numtagvon { get; set; } public int? numtagbis { get; set; } public int? nummonvon { get; set; } public int? nummonbis { get; set; } public int? numjahrvon { get; set; } public

kendo ui web selected combobox value set in textbox

Here i am using razor view <div class="editor-label"> @Html.LabelFor(model => model.ob_guid,"Im Objekt") </div> <div class="editor-field"> @(Html.Kendo().ComboBoxFor(model=>model.ob_guid) .Name("categories") .HtmlAttributes(new { style = "width:300px",id="categories" }) .Placeholder("Select category...") .DataTextField("CategoryName") .DataValueField("CategoryId") .Filter(FilterType.Contains) .DataSource(source => { source.Read(read => { read . Action ( "GetCascadeCategories" , "Limitations" ); }); }) ) </div> <div class="editor-label"> @Html.LabelFor(model => model.von,"Code") </div> <

how to import .csv file into sql server using c#

I am using the ASP.NET MVC. here is the code that might help you that how to you convert the CSV file in List and after that you will able to save the List data in to SQL. [HttpPost] public ActionResult Create(t_NextDevAttendence t_nextdevattendence, IEnumerable<HttpPostedFileBase> files) { // Read the CSV file name & file path // I am usisg here Kendo UI Uploader string path = ""; string filenamee = ""; if (files != null) { foreach (var file in files) { var fileName = Path.GetFileName(file.FileName); path = Path.GetFullPath(file.FileName); filenamee = fileName; } // Read the CSV file data StreamReader sr = new StreamReader(path); string line = sr.ReadLine(); string[] value = line.Split(','); DataTable dt = new DataTabl

C# remove item from ListObject

private void OnDeleteItemCommand(BO.DC_RequisitionItem reqItem) { if (reqItem.id != 0) { var objReqItem = ViewData.Requisition.DC_RequisitionItemList.SingleOrDefault(m => m.id == reqItem.id); if (objReqItem != null) { //Get deleted item by item id var itemList = new ObservableCollection<BO.DC_RequisitionItem>(); foreach (var mx in ViewData.Requisition.DC_RequisitionItemList.Where(mx => mx.ReqRefNo == reqItem.id)) { itemList.Add(mx); } if (itemList.Any()) { foreach (var m in itemList) { ViewData.Requisition.DC_RequisitionItemList.Remove(m); var da = ViewData.Requisition.DC_RequisitionItemList.FirstOrDefault( mx =>m.ReqRefNo == objReqItem.id); if (da != null)

Directory Listing -- / in silverlight application

In your silverlight application if can see the error. It may also arise after get latest from the source safe control. No need to worry just set up as start up page of your web ASPX file.

Silverlight assembly rename

1. Rename your Silverlight application as you want to give the assembly name of your application. 2. Right click on the project -> properties -> Silverlight  rename the same as you give first on the red marking only. 3. Click on assembly also rename here only marking 4. Buid the project. if you run it you will get error. becoz the aspx file now running the previous xap file. so you must also have to rename as your newly assembly file/xap file in the aspx file as following figure. Now build & run you application.

C# Linq Sum from a listObject

we can easily find out the sum from a list of collection. if the list is used in data grid or any other control as a data source we can easily find out the sum of any item field from the list using LINQ. var totalQty = ViewData.Requisition.DC_RequisitionItemList.Sum(item => item.ItemTotalValue); ViewData.TotalQty = totalQty; Thanks.

Add service after Migrating a Silverlight application in VS-2012

After migrating a Silverlight application in VS-2012, our existing service is not exposed in VS-2012. Or if we create a new Silverlight application in VS-2012 and want to use the existing service in new application then our existing service will not exposed in VS-2012. We can use existing service in VS-2012 Silverlight application by following the steps. 1.      1.  We have to open the application in VS-2010     1.       2. If you are using n tier project in your then many other project will not be show ( incompatible ). But this is not a problem. You just clean the Silverlight client application. 1.     3.  Expand the client project right click on Service References . Here it is important that if are using source control & if you have already ServiceReferences.ClientConfig file. Then it should also be check out & check that which service you are going to add is that already exist. If exist delete the service from Client &