Posts

Showing posts from 2016

Create Trigger while update Specific column of table

ALTER TRIGGER trgAfterContractDeedFileURLUpdate ON  [Contract] FOR UPDATE AS begin     declare @BusinessUnit nvarchar(50); declare @newContractDeedUrl nvarchar(250); declare @oldContractDeedUrl nvarchar(250);     set @BusinessUnit = 'Insert To ContractDeedUrlHistory if Contract Deed URL is updated.' select @newContractDeedUrl = ContractDeedUrl from inserted; select @oldContractDeedUrl = ContractDeedUrl from deleted; if(@newContractDeedUrl <> @oldContractDeedUrl) begin insert into ContractDeedUrlHistory(ContractNo,ContractDate, OwnerID,ContractDeedUrl,Entry_By,Entry_Date) SELECT ContractNo,ContractDate, OwnerID,ContractDeedUrl,Entry_By,Entry_Date FROM deleted end ;       end

Create Trigger while update any column of table

CREATE TRIGGER trgAfterContractDeedFileURLUpdate ON  [Contract] FOR UPDATE AS begin     declare @BusinessUnit nvarchar(50)     set @BusinessUnit = 'Insert To ContractDeedUrlHistory if Contract Deed URL is updated.'     insert into         ContractDeedUrlHistory(ContractNo,ContractDate, OwnerID,ContractDeedUrl,Entry_By,Entry_Date)     SELECT         ContractNo,ContractDate, OwnerID,ContractDeedUrl,Entry_By,Entry_Date     FROM         deleted       end

Crystal Reports Grouping by Week

Image
Right click-Report-Group Expert-Select Date field you want to group-select Options-In common tab in "The Section will be  printed" dropdown changes to for each week .

System.OutOfMemoryException" exception when you execute a query c#

DatabaseConnector connector = new DatabaseConnector();             connector.OpenConnection();             try             {                 DataTable dt = new DataTable();                 SqlDataAdapter da = new SqlDataAdapter(queryString, connector.Connection);                 da.SelectCommand.CommandTimeout = 0;                 da.Fill(dt);                 return dt;             }             catch (SqlException ex)             {                 return null;                           }  ...

Entity framework left join

var query = (from u in _StyleSizeRepository.GetAll()                     join p in _buyCentralRepository.GetAll() on u.Barcode equals p.BarCode into gj                     from x in gj.DefaultIfEmpty()                     select new StyleSize()                     {                         Barcode = u.Barcode,                         sBarcode = u.sBarcode,                         BTID = u.BTID,                         BTName = u.BTName,                               ...

Date Range comparison in Lambda Expression (Entity Framework)

 public IEnumerable<CRM_Customer> GetCustomersByMultipleFilter(DateTime sEnlistedDate, DateTime eEnlistedDate, string Branch, int Category,string Gender, int City, int Location, int AgeFrom, int AgeTo, DateTime BirthdayDate,DateTime MarriageDayDate, string SingleCustomer)         {             DateTime minDate = Convert.ToDateTime(DateTime.MinValue.ToShortDateString());             IEnumerable<CRM_Customer> CustomerList = (from a in DbContext.CRM_Customer                                 where (a.SubscriptionDate >= sEnlistedDate && a.SubscriptionDate <= eEnlistedDate)                                 && ((DateTime.Now.Year - ((a.DOB.Value.Year))) >= AgeFrom && (DateTime.Now.Year - ((a.DOB.Value...

Login failed for user IIS APPPOOL\DefaultAppPool

Run This Script :  CREATE LOGIN [IIS APPPOOL\DefaultAppPool] FROM WINDOWS GO --USE Table Name GO CREATE USER [IIS APPPOOL\DefaultAppPool] FOR LOGIN [IIS APPPOOL\DefaultAppPool] GO EXEC sp_addrolemember 'db_datareader', 'IIS APPPOOL\DefaultAppPool' GO EXEC sp_addrolemember 'db_datawriter', 'IIS APPPOOL\DefaultAppPool' GO

Check or unchecked parent checkboxes and child checkboxes in nested ul li

 I generated menulist using c#. Html : <div style= "border: solid 1px #e5e5e5; padding: 10px; background-color: #FAFAFA; width: 100%; >                 <label>                     <input type=" checkbox " class=" checkbox-inline " id=" select_all "> Select All                 </label>                 <div class=" treeview ">                     @if (Model != null && Model.Count() > 0)                     {                         <ul>                             @GetTreeView(Model, (int) Model.FirstOrDefault().ParentMenuId)     ...