15,897,518 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Devraj Kapdi (Top 35 by date)
Devraj Kapdi
3-Mar-16 7:00am
View
thank u d@nish it worked for me with little modification for datatable as...
List <datarow> filtered = dtOrderHistotyFinal.AsEnumerable().ToList().OrderByDescending(x => Convert.ToInt32(x["col1"].ToString().Substring(x["col1"].ToString().LastIndexOf("-") + 1))).GroupBy(x => x["col1"].ToString().Substring(0, x["col1"].ToString().LastIndexOf("-"))).Select(x => x.First()).ToList();
Devraj Kapdi
3-Mar-16 6:04am
View
I want it with LINQ in C#
Devraj Kapdi
3-Mar-16 5:52am
View
the datatable containing only single column.
Devraj Kapdi
3-Mar-16 5:45am
View
yes
Devraj Kapdi
1-Sep-15 7:53am
View
I did the same, the angular braces are not displaying here
ID = r.Field int ("CNTM_CONTACT_ID"),
Status = r.Field string ("CNTM_ISACTIVE"),
Date = r.Field datetime ("ActiveDate")
Devraj Kapdi
1-Sep-15 7:08am
View
Hello sir....
M getting cast related error as "Specified cast is not valid."
DataTable dtFinal = gDataset12.Tables[0].Clone();
var myLinq = gDataset12.Tables[0].AsEnumerable()
.GroupBy(r => new
{
ID = r.Field<int>("CNTM_CONTACT_ID"), //each ID
Date = r.Field<datetime>("ActiveDate").Date
})//each Day
.Select(g => g.OrderByDescending(r => r.Field<datetime>("ActiveDate")).First()) //item in group with max time
.Select(r => new
{
ID = r.Field<int>("CNTM_CONTACT_ID"),
Status = r.Field<string>("CNTM_ISACTIVE"),
Date = r.Field<datetime>("ActiveDate")
});
myLinq.ToList().ForEach(aa =>
{
DataRow row = dtFinal.NewRow();
row["CNTM_CONTACT_ID"] = aa.ID;
row["CNTM_ISACTIVE"] = aa.Status;
row["ActiveDate"] = aa.Date;
dtFinal.Rows.Add(row);
});
Devraj Kapdi
1-Sep-15 5:55am
View
Hello sir.
Devraj Kapdi
1-Sep-15 5:05am
View
yes, i want the result in datatable
Devraj Kapdi
31-Aug-15 6:21am
View
yes,can u tell me why m getting this .. ((System.Linq.OrderedEnumerable<<>f__AnonymousType1,System.DateTime>)(result)) {System.Linq.OrderedEnumerable<<>f__AnonymousType1,System.DateTime>}
Devraj Kapdi
31-Aug-15 4:38am
View
at ID for int value..system date separator is / (8/31/2015)
-----------------------------------------------------------------------
((System.Linq.OrderedEnumerable<<>f__AnonymousType1<int,string,system.datetime,string>,System.DateTime>)(result)) {System.Linq.OrderedEnumerable<<>f__AnonymousType1<int,string,system.datetime,string>,System.DateTime>}
the value m getting
Devraj Kapdi
31-Aug-15 4:32am
View
this is the data table m getting from SQL
CNTM_CONTACT_ID | CNTM_ISACTIVE | ActiveDate
-------------------------------------------
2706 Y 2015-08-27 14:26:25.103
2706 N 2015-08-27 14:33:42.053
2707 Y 2015-08-27 14:26:22.227
2707 N 2015-08-27 14:27:11.000
2710 Y 2015-08-25 17:07:01.937
2710 N 2015-08-27 14:16:42.420
2710 Y 2015-08-27 14:18:56.347
2710 N 2015-08-27 14:27:07.753
2755 Y 2015-08-25 17:06:59.210
2755 N 2015-08-26 11:27:28.643
2755 Y 2015-08-26 11:27:35.143
2755 N 2015-08-27 14:16:39.917
2755 Y 2015-08-27 14:18:53.477
2755 N 2015-08-27 14:26:49.217
This is the LINQ i modified ....
var result = dtFinal.AsEnumerable()
.GroupBy(r => new { ID = r.Field<int>("CNTM_CONTACT_ID"), Day = r.Field<datetime>("ActiveDate").Date.ToString("yyyy-MM-dd") })
.Select(grp => new
{
ID = grp.Key.ID,
Day = grp.Key.Day,
Date = grp.Max(d => d.Field<datetime>("ActiveDate")),
Status = grp.Where(p => p.Field<datetime>("ActiveDate") == grp.Max(d => d.Field<datetime>("ActiveDate"))).Select(s => s.Field<string>("CNTM_ISACTIVE")).FirstOrDefault()
})
.OrderBy(c => c.ID)
.ThenBy(b => b.Date);
m not getting the result ...
Devraj Kapdi
31-Aug-15 4:30am
View
hello ... and i didnt get the result it showing me Specified cast is not valid". error
Devraj Kapdi
31-Aug-15 3:48am
View
Hello Maciej ,
How can i get this result in datatable from "result" LINQ
Devraj Kapdi
31-Aug-15 3:41am
View
Hello sir ,,, m getting "Specified cast is not valid". error while converting myLinq to datatable.
Devraj Kapdi
31-Aug-15 2:45am
View
Deleted
Hello sir ,,, m getting "Specified cast is not valid". error while converting myLinq to datatable.
Devraj Kapdi
28-Aug-15 4:46am
View
Hello Andy i am getting this error :
Error 13 'System.DateTime' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'System.DateTime' could be found (are you missing a using directive or an assembly reference?)
Devraj Kapdi
28-Aug-15 2:45am
View
i didnt get the resulting output
Devraj Kapdi
27-Aug-15 8:35am
View
ID Status Date
-------------------------------------------
2706 Y 2015-08-27 14:26:25.103
2706 N 2015-08-27 14:33:42.053
2707 Y 2015-08-27 14:26:22.227
2707 N 2015-08-27 14:27:11.000
2710 Y 2015-08-25 17:07:01.937
2710 N 2015-08-27 14:16:42.420
2710 Y 2015-08-27 14:18:56.347
2710 N 2015-08-27 14:27:07.753
2755 Y 2015-08-25 17:06:59.210
2755 N 2015-08-26 11:27:28.643
2755 Y 2015-08-26 11:27:35.143
2755 N 2015-08-27 14:16:39.917
2755 Y 2015-08-27 14:18:53.477
2755 N 2015-08-27 14:26:49.217
Hello, Here is my DataTable above ... from this i want in c# as the max date record by ID and its status
2706 N 2015-08-27 14:33:42.053
2707 N 2015-08-27 14:27:11.000
2710 N 2015-08-27 14:27:07.753
2755 N 2015-08-27 14:26:49.217
2755 Y 2015-08-26 11:27:35.143
2710 Y 2015-08-25 17:07:01.937
2755 Y 2015-08-25 17:06:59.210
Devraj Kapdi
25-Aug-15 1:41am
View
Im getting this error
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "CNTM.CNTM_CONTACT_ID" could not be bound.
Devraj Kapdi
24-Aug-15 8:59am
View
yes its working correct... u can proceed
Devraj Kapdi
24-Aug-15 8:32am
View
no it wont worked for me... As i have LOG of active and deactive users. the scenario is admin can active and deactive the users randomly in a day the log of that is inserted into the table.
i want the count of latest active users suppose admin can deactive the active user than the log is inserted ,.. again the admin activate that user the log is inserted again... the count for each user which are activated that i want to count for each day. for generating graph of active users per day...
Below is the query i used but it shows me only current date data as i used MAX function for date...
select CNTM.CNTM_CONTACT_ID,CNTM.CNTM_ISACTIVE,CNTM.CNTM_Active_Date as ActiveDate,
day(Convert(varchar, CNTM.CNTM_Active_Date ,110)) as ActiveDay,
month(Convert(varchar, CNTM.CNTM_Active_Date ,110)) as ActiveMonth,
year(Convert(varchar, CNTM.CNTM_Active_Date ,110)) as ActiveYear
from USER_MST inner join CONTACT_MST CNTM1 on USRM_CONTACTID=CNTM1.CNTM_CONTACT_ID
inner join USERROLEREL_DET on URRD_USER_ID=USRM_USER_ID inner join ROLE_MST on URRD_ROLE_ID=ROLM_ROLE_ID
inner join CONTACT_MST_LOG CNTM on CNTM1.CNTM_CONTACT_ID = CNTM.CNTM_CONTACT_ID
where USRM_COMPANY_ID= '544' and ROLM_ROLE_ID = 9 AND CNTM.CNTM_ISACTIVE = 'Y'
AND CNTM.CNTM_Active_Date = ( select max(CNTM_Active_Date) from CONTACT_MST_LOG b
where CNTM.CNTM_CONTACT_ID = b.CNTM_CONTACT_ID )
group by CNTM.CNTM_Active_Date,CNTM.CNTM_CONTACT_ID,CNTM.CNTM_ISACTIVE,
day(Convert(varchar, CNTM.CNTM_Active_Date ,110)),
month(Convert(varchar, CNTM.CNTM_Active_Date ,110)),
year(Convert(varchar, CNTM.CNTM_Active_Date ,110))
Order by year(Convert(varchar, CNTM.CNTM_Active_Date ,110)) ,month(Convert(varchar, CNTM.CNTM_Active_Date ,110))
below is my table structure
CREATE TABLE [dbo].[CONTACT_MST_LOG](
[CNTM_CONTACT_ID] [numeric](18, 0) NOT NULL,
[CNTM_CREATED_BY] [numeric](18, 0) NULL,
[CNTM_CREATED_DATE] [datetime] NULL,
[CNTM_MODIFIED_BY] [numeric](18, 0) NULL,
[CNTM_MODIFIED_DATE] [datetime] NULL,
[CNTM_ISACTIVE] [varchar](1) NULL,
[CNTM_ISBLOCKED] [varchar](1) NULL,
[CNTM_BLOCKED_BY] [numeric](18, 0) NULL,
[CNTM_BLOACKED_DATE] [datetime] NULL,
[CNTM_Active_By] [numeric](18, 0) NULL,
[CNTM_Active_Date] [datetime] NULL
) ON [PRIMARY]
Devraj Kapdi
13-Aug-15 5:14am
View
Please study http://www.codeproject.com/ how it works.
Devraj Kapdi
10-Mar-15 7:38am
View
Thank u Peter. i tried before with the same but it wont helped me . you solved my issue. thank u.
Devraj Kapdi
23-Feb-15 5:31am
View
I have xml string response in ajax success function from server based on that i want to create a tree in Jquery. and clicking on the tree node it will show its ID and TAG.
Devraj Kapdi
23-Feb-15 5:28am
View
i already did it buddy... its out of my requirements.
Devraj Kapdi
24-Sep-14 6:47am
View
can you post code for decryption
Devraj Kapdi
5-Sep-14 5:02am
View
thank you
Devraj Kapdi
5-Sep-14 5:02am
View
thank you
Devraj Kapdi
7-Mar-14 2:50am
View
Thank you Sergey Alexandrovich ... :)
Devraj Kapdi
14-Feb-14 7:47am
View
Go to below link will work ork u
http://demos.telerik.com/aspnet-ajax/filter/examples/integration/defaultcs.aspx?product=filter#qsf-demo-source
http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/basic-filtering/defaultcs.aspx
Devraj Kapdi
14-Feb-14 7:12am
View
try this
yourControl.DataSource = gridviewcellvalue;
And if you are using WebForms you will need to add this line:
yourControl.DataBind();
Devraj Kapdi
14-Feb-14 7:03am
View
see its because Itextsharp not understanding the characters in files.
if possible use ghostscript instead .. will helps you
http://www.ghostscript.com/download/gsdnld.html
Devraj Kapdi
14-Feb-14 5:26am
View
can u please send me your PDF file
Devraj Kapdi
31-Jan-14 8:00am
View
welcome brother :)
Devraj Kapdi
31-Jan-14 1:07am
View
Thank you sir... for your reply.
Show More