15,910,773 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 pryashrma (Top 63 by date)
pryashrma
25-Mar-13 1:02am
View
post d reply to solution in comment section! to send notification to the member
pryashrma
25-Mar-13 0:59am
View
please provide the url of page as required
pryashrma
23-Mar-13 7:35am
View
please provide more info
pryashrma
23-Mar-13 7:30am
View
from code behind- use form1.Controls.Add()
pryashrma
23-Mar-13 3:13am
View
do it in javascript
pryashrma
22-Mar-13 7:49am
View
why don't u use Menu Server Control
pryashrma
22-Mar-13 7:31am
View
Deleted
try replacing dt in your code with dt.ToShortDateString() in sql query statement
pryashrma
22-Mar-13 2:02am
View
Thank You!!! got d point!
The error generated, as AttendanceId is Auto Incrementing so can't insert it explicitly.
Problem Resolved!!!!
pryashrma
22-Mar-13 1:43am
View
Thanks for d help! but problem not yet resolved.. Could U plz help?
My Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: ps
-- Create date:
-- Description:
-- =============================================
CREATE TRIGGER dbo.trgInsertAttendance
ON dbo.tblAttendance
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON
IF EXISTS
(
SELECT 1
FROM dbo.tblAttendance T
INNER JOIN INSERTED I
ON T.AttendanceDate = I.AttendanceDate
AND T.EmpCode = I.EmpCode
)
BEGIN
-- Do dupe handling here
PRINT 'Duplicate Attendance'
RAISERROR('Cannot Mark Attendance.. As Attendance already Marked for the day!',16,1)
return
END
-- actually add it in
INSERT INTO
dbo.tblAttendance
SELECT
*
FROM
INSERTED I
END
GO
but it is generating following ERROR:
Msg 8101, Level 16, State 1, Procedure trgInsertAttendance, Line 28
An explicit value for the identity column in table 'dbo.tblAttendance' can only be specified when a column list is used and IDENTITY_INSERT is ON.
pryashrma
22-Mar-13 1:06am
View
Tried like this, but it is totally wrong:
CREATE TRIGGER dbo.trgBeforeInsert
ON dbo.tblAttendance
AFTER INSERT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
IF EXISTS (SELECT tblAtt.AttendanceDate , tblAtt.EmpCode
FROM dbo.tblAttendance tblAtt
JOIN inserted AS i
ON tblAtt.AttendanceDate=i.AttendanceDate and tblAtt.EmpCode =i.EmpCode
where tblAtt.AttendanceDate=i.AttendanceDate and tblAtt.EmpCode =i.EmpCode
)
BEGIN
RAISERROR ('Attendance Alreday Marked!', 16, 1);
ROLLBACK TRANSACTION;
RETURN
END;
END
GO
commit;
pryashrma
12-Mar-13 6:58am
View
tried d link... but problem not resolved
pryashrma
9-Mar-13 5:25am
View
It is Public...
just try yourself once
pryashrma
6-Mar-13 23:52pm
View
USE [dbAttendance]
GO
/****** Object: Table [dbo].[tblAttendance] Script Date: 03/07/2013 10:14:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tblAttendance](
[AttendanceId] [bigint] IDENTITY(1,1) NOT NULL,
[EmpCode] [varchar](50) NOT NULL,
[ProjectName] [varchar](50) NOT NULL,
[Status] [char](1) NOT NULL,
[AttendanceDate] [date] NOT NULL,
[AttendanceBy] [varchar](50) NOT NULL,
[DOE] [datetime] NOT NULL,
[ApprovedBy] [varchar](50) NULL,
[ApprovedOn] [datetime] NULL,
[ApprovedFlag] [char](1) NOT NULL,
[Comments] [nvarchar](1500) NULL,
CONSTRAINT [PK_tblAttendance] PRIMARY KEY CLUSTERED
(
[AttendanceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Present-P; Absent-A; Leave-L; Tour-T; Holiday-H; Sunday-S;' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAttendance', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Pending-P; Approved-A; Rejected-R' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAttendance', @level2type=N'COLUMN',@level2name=N'ApprovedFlag'
GO
pryashrma
6-Mar-13 23:41pm
View
got it!
pryashrma
6-Mar-13 5:35am
View
Thanks for replying!
Problem not yet resolved, now the query is generating n rows for n attendance dates for each employee... Any suggestions...
EmpCode ProjectName 1 2 3 4 5
------- ----------- - - - - -
A100 p1 NULL NULL P NULL NULL
A100 p1 NULL NULL NULL P NULL
A100 p1 NULL NULL NULL NULL P
A100 p1 NULL NULL NULL NULL NULL
A101 p3 NULL NULL P NULL NULL
A101 p3 NULL NULL NULL P NULL
A101 p3 NULL NULL NULL NULL L
A102 p3 NULL NULL P NULL NULL
A102 p3 NULL NULL NULL P NULL
A102 p3 NULL NULL NULL NULL A
.
.
and I more request.... could u plz explain why ' max(status) ' was used????
pryashrma
5-Mar-13 23:59pm
View
Thanks for the suggestion, I tried but sql express is throwing following error:Incorrect syntax near the keyword 'FOR'.
I have no idea for resolving the error
Query:
SELECT [EmpCode], [ProjectName],[1] , [2],[3],[4],[5]
FROM
(SELECT Day([AttendanceDate]) as d1, [EmpCode],[ProjectName],[AttendanceDate] , [Status]
FROM [tebs].[dbo].[View_Attendance]) p
PIVOT(
[Status]
FOR d1 IN ( [1] , [2],[3],[4],[5]) ) AS pvt
ORDER BY
pvt.[EmpCode], pvt.[ProjectName];
Could u plz help!
pryashrma
5-Mar-13 7:54am
View
i don't want to use html reports... but your idea of customizing cell is great! Thanks
pryashrma
17-Jan-13 7:53am
View
please provide code
pryashrma
16-Jan-13 23:30pm
View
try using OnRowBound event
pryashrma
16-Jan-13 1:55am
View
you're welcome
pryashrma
16-Jan-13 0:27am
View
Deleted
check dis line
string s = "select * from " + DropDownList1.Items[1].ToString();
replace 1 with i
pryashrma
5-Jan-13 2:28am
View
plz refer updated question
pryashrma
5-Jan-13 2:12am
View
not working... could u plz explain the functionin of top 1
pryashrma
5-Jan-13 1:59am
View
Thanks for trying
pryashrma
5-Jan-13 1:58am
View
Thanks alot
pryashrma
28-Nov-12 6:42am
View
cannot find control for total field
pryashrma
28-Nov-12 5:37am
View
instead of storing image..u can upload it in particular folder and save image url in database, and then simply bind imageUrl in image control... like
imgPhoto.ImageUrl=dtall.Rows[0]["userimgUrl"].ToString()
pryashrma
28-Nov-12 5:31am
View
please specify how u r creating gridview... either auto genratin columns or through designing them
pryashrma
28-Nov-12 5:21am
View
does it generates any error... include exception message in catch
pryashrma
28-Nov-12 0:36am
View
inherits="classname in codebehind"
pryashrma
28-Nov-12 0:17am
View
replace Inherits="NewTestProject._Default"
with
Inherits="_Default"
pryashrma
24-Nov-12 4:55am
View
it doesn't stop browser from showing the prev. page on 'back' btn click
pryashrma
24-Nov-12 4:53am
View
it doesn't stop browser from showing the prev. page
pryashrma
24-Nov-12 0:53am
View
don't have problem with logout code...
problem is to restrict browser from showing previous page, when back button is clicked if user logouts
pryashrma
24-Nov-12 0:53am
View
don't have problem with logout code...
problem is to restrict browser from showing previous page, when back button is clicked
pryashrma
24-Nov-12 0:52am
View
this is the logout code... but it doesn't restrict browser from showing previous page, when back button is clicked
pryashrma
22-Nov-12 4:14am
View
Thanks for your comments
pryashrma
22-Nov-12 3:01am
View
before assigning value to Payment Amount textbox, check the value
or
use try..catch
pryashrma
19-Nov-12 1:06am
View
not getting your point..
want to print '%' symbol
or problem is with the calculation
pryashrma
17-Nov-12 7:57am
View
does this line help you-
this.dataGridView1.Columns["UnitPrice"].DefaultCellStyle.Format = "F3";
pryashrma
17-Nov-12 7:48am
View
sorry can't help
pryashrma
17-Nov-12 7:44am
View
does cell[5] of grid view contains multiple controls
pryashrma
17-Nov-12 7:41am
View
i found no error.. try debugging again or add jst above the ending brackets-Response.Write("outtime:"+txt_outtime.Text);
pryashrma
17-Nov-12 7:32am
View
try this
set
Mask="99:99:99"
pryashrma
17-Nov-12 7:30am
View
please provide the save function
pryashrma
17-Nov-12 7:08am
View
does value of database field "ID" and variable "i" are same?
pryashrma
17-Nov-12 6:59am
View
are you asking the query for 'GridView' control
pryashrma
17-Nov-12 6:54am
View
Deleted
please tell me if i m confusing you
pryashrma
17-Nov-12 6:54am
View
Deleted
in aspx page design mode
click on ">" of gridView1
then click on 'Edit Columns'
then select respective field and set 'DataFormatString'
you can also view the following link
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx
pryashrma
17-Nov-12 6:51am
View
Deleted
Alternate and easy way:
set the DataFormatString of Databound field
Format: {0:F}
1234.567 -> 1234.57
Format: {0:F3}
1234.567 -> 1234.567
for eg:
DataFormatString ="{0:F3}"
pryashrma
17-Nov-12 6:38am
View
Deleted
you are asking the query for 'GridView' control
pryashrma
10-Nov-12 7:55am
View
Thanks for the help
pryashrma
10-Nov-12 1:12am
View
calendar popups but cannot b clicked.. anyway thanks for trying
pryashrma
6-Nov-12 6:55am
View
right
pryashrma
6-Nov-12 6:43am
View
Thanks for the help
pryashrma
6-Nov-12 4:57am
View
Thanks for trying
pryashrma
6-Nov-12 4:57am
View
Thanks for trying
pryashrma
6-Nov-12 4:57am
View
Thanks for trying
pryashrma
6-Nov-12 4:56am
View
Thanks for the help! it worked. The problem was that i was missing the RowIndex of the Selected Row
pryashrma
6-Nov-12 1:05am
View
i have button- btnAddDetails just below the textbox- txtCustName in grid Item template, and on btnAddDetails_Click event i am trying to fetch the value
pryashrma
6-Nov-12 0:49am
View
how can i use them to fetch the textbox value
pryashrma
6-Nov-12 0:44am
View
i want to use the textbox value further, so could you plz explain how can i store its value in a string variable in .aspx.cs page
pryashrma
6-Nov-12 0:42am
View
please explain
Show More