Click here to Skip to main content
15,397,084 members

Comments by Abdulnazark (Top 14 by date)

Abdulnazark 13-Mar-15 16:03pm View
   
declare @in varchar(max),@sql Nvarchar(max)

set @in=cast((select stuff((select ',['+datenumber +']' from ##t2 group by datenumber for xml path('')) ,1,1,'')) as varchar(max))

set @sql='SELECT *
FROM (
SELECT
code,
dt,
datenumber
FROM ##t2
) as s
PIVOT
(
MAX(dt)
FOR [datenumber] IN ('+@in+')
)AS p'
exec(@sql)
Abdulnazark 13-Mar-15 15:16pm View
   
thanks..
Abdulnazark 12-Mar-15 12:24pm View
   
Sql view only available for Query not for table
Abdulnazark 2-Mar-15 9:08am View
   
Deleted
don't use Clipboard, see the link
http://www.aspsnippets.com/Articles/Export-GridView-to-Excel-in-ASPNet-with-Formatting-using-C-and-VBNet.aspx
Abdulnazark 2-Mar-15 2:35am View
   
did you enabled the

sp_configure 'show advanced options', 1
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1
GO
RECONFIGURE;
GO
Abdulnazark 1-Mar-15 12:04pm View
   
is this work for you,

select * from yourtable where acid=100
union select * from yourtable where acid <>100
Abdulnazark 1-Mar-15 9:19am View
   
worked below
var qry = (from a in cm.Cust_Complaints.ToList()
group a by new { Year = a.RecDate.Value.Year, Month = a.RecDate.Value.ToString("MMMM"), Dept = a.RelDept } into grp
select new
{
Year = grp.Key.Year,
Month = grp.Key.Month,
Dept = grp.Key.Dept,
AvgIA = grp.Average(g => ((g.Intl_Ack != null ? g.Intl_Ack.Value : DateTime.Today.Date) - g.RecDate.Value).Days) + 1,
AvgRD = grp.Average(g => (((g.Resol_Date != null ? g.Resol_Date.Value : DateTime.Today.Date) - g.RecDate.Value).Days) + 1),


SumOp = grp.Sum(g => g.Status == "Open" ? 1 : 0)
});
GridView1.DataSource = qry;
GridView1.DataBind();
thank you,
Abdulnazark 1-Mar-15 8:59am View
   
this fine except a.RecDate.ToString("MMM")

thank you,

the error is

An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code

Additional information: LINQ to Entities does not recognize the method 'System.String ToString(System.String)' method, and this method cannot be translated into a store expression.
Abdulnazark 1-Mar-15 7:37am View
   
How to check the null
Abdulnazark 1-Mar-15 6:18am View
   
attached sample data, It will be appreciated if you could post a complete LINQ query
Abdulnazark 1-Mar-15 6:15am View
   
TrID RecDate ModeOfComp RelDept Intl_Ack Resol_Date ClosureDate Status
27 19/01/14 Letter Service 00:00.0 19/02/14 19/02/14 Closed
28 05/02/14 Fax Service 00:00.0 20/02/14 20/02/14 Closed
29 25/03/14 Email Service 00:00.0 30/03/14 30/03/14 Closed
30 06/04/14 Fax Service 00:00.0 18/05/14 20/05/14 Closed
31 08/04/14 Direct Service 00:00.0 12/04/14 15/04/14 Closed
32 09/04/14 Telephone Service 00:00.0 10/04/14 12/04/14 Closed
33 28/04/14 Telephone Service 00:00.0 02/06/14 NULL Closed
34 12/05/14 Fax Construction 00:00.0 15/05/14 NULL Closed
35 12/05/14 Letter Service 00:00.0 20/05/14 NULL Closed
36 12/05/14 Email Service 00:00.0 20/05/14 NULL Open
37 30/04/14 Telephone Service 00:00.0 03/05/14 NULL Open
38 24/06/14 Telephone Service 00:00.0 02/07/14 NULL Closed
40 25/06/14 Fax NESales 00:00.0 NULL NULL Open
41 30/06/14 Fax NESales 00:00.0 NULL NULL Open
42 27/07/14 Email Service 00:00.0 03/08/14 NULL Closed
43 25/09/14 Fax Service 00:00.0 NULL NULL Open
44 30/09/14 Email Service 00:00.0 NULL NULL Open
45 30/09/14 Telephone Construction 00:00.0 31/10/14 NULL Open
Abdulnazark 26-Feb-15 7:45am View
   
Just run the attached sql after creating the table from the above,you will get the result,
Abdulnazark 26-Feb-15 4:24am View
   
your dates may be starting from February only, please check
Abdulnazark 26-Feb-15 3:30am View
   
see below link
http://csharp.net-informations.com/excel/csharp-open-excel.htm