16,004,901 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 .NET 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 sahmed4 (Top 10 by date)
sahmed4
28-Mar-13 1:32am
View
Maciej los.
Please refer my descriptive problem in the below link and try to find out any solution for updating the records based on role id values
Error in Updating the Sp with splitted values
[
^
]
sahmed4
27-Mar-13 8:36am
View
Yes prasad,
I have did it like tat only for time being ..deleted the current roleids and inserted it again..
sahmed4
27-Mar-13 4:20am
View
Please find out this link
http://www.codeproject.com/Questions/568241/ErrorplusinplusUpdatingplustheplusSppluswithplussp
specified my problem in elaborately...
sahmed4
27-Mar-13 4:18am
View
HI prasad,
Have a look in my table structure
select * from Roles
Id RoleName RoleCode
12 Admin NULL
13 Manager NULL
14 Manager2 NULL
Select * from rights
Id RightId RoleId
22 1 12
23 2 12
24 1 13
25 2 13
26 3 13
27 1 14
28 2 14
29 5 14
30 8 14
If i select Manager2 to Edit then My @RoleId values will be 1 2 5 & 8 now i need to update these values based on passing all these id's as 1 2 5 & 8 individually
sahmed4
27-Mar-13 3:30am
View
Hi.
while Inserting values into table Rights i am getting the Current Auto increment value but how do i do this for update sp if i have @Roles values="1,3,5,7,8," that will insert in as 1 3 5 7 8 individually in all the newly created rows in rights table but while updating how do handle this
This is my Insert Sp
====================
ALTER PROC [C244570_hrms12].[h_AddRole]
(
@RoleName NVARCHAR(MAX),
@Roles NVARCHAR(MAX)
)
AS
DECLARE @RoleID INT,@StartingPos INT,@RecPos INT,@RightId INT
DECLARE @RecSet VARCHAR(500)
BEGIN
INSERT INTO ROLES(RoleName) VALUES(@RoleName)
SET @StartingPos=1
SET @RoleId=(SELECT IDENT_CURRENT('ROLES'))
WHILE @StartingPos<=LEN(@roles)
BEGIN
SELECT @RecPos=CHARINDEX(',',@roles,@StartingPos)
SELECT @RecSet=SUBSTRING(@roles,@StartingPos,@Recpos-@StartingPos)
SET @RightId=@RecSet
INSERT INTO Rights(RightId,RoleId)VALUES(@RightId,@roleId)
SELECT @StartingPos=@RecPos+1
END
END
this is my Update SP
====================
ALTER PROC [C244570_hrms12].[h_UpdateRole]
(
@Id INT,
@RoleName NVARCHAR(MAX),
@Roles NVARCHAR(MAX)
)
AS
DECLARE @RoleId INT,@StartingPos INT,@RecPos INT,@RightId INT
DECLARE @RecSet VARCHAR(500),@Rid NVARCHAR(50)
BEGIN
UPDATE Roles SET RoleName=@RoleName WHERE Id=@Id
SET @StartingPos=1
SET @Rid=(SELECT ID FROM RIGHTS WHERE RoleId=@RoleId)
WHILE @StartingPos<=LEN(@roles)
BEGIN
SELECT @RecPos=CHARINDEX(',',@roles,@StartingPos)
SELECT @RecSet=SUBSTRING(@roles,@StartingPos,@RecPos-@StartingPos)
SET @RightId=@RecSet
UPDATE Rights SET RightId=@RightId,RoleId=@RoleId WHERE Id=@Rid
ENDs
END
sahmed4
26-Mar-13 2:51am
View
dash,
Please have a look in to my code i am trying to edit the fields which also has a check box list control where i have binded values dynamically..
<pre lang="cs">protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Request.QueryString["Id"] != null)
{
Edit();
}
}
}
protected void Edit()
{
int id = Convert.ToInt32(Request.QueryString["Id"].ToString());
DataTable dt1 = s.GetAccessRightsByRole(id.ToString());
if (dt1.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt1.Rows[i]["RightId"].ToString() == "1")
{
CheckBoxList1.Items[0].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "2")
{
CheckBoxList1.Items[1].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "3")
{
CheckBoxList1.Items[2].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "4")
{
CheckBoxList1.Items[3].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "5")
{
CheckBoxList1.Items[4].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "6")
{
CheckBoxList1.Items[5].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "7")
{
CheckBoxList1.Items[6].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "8")
{
CheckBoxList1.Items[7].Selected = true;
}
if (dt1.Rows[i]["RightId"].ToString() == "9")
{
CheckBoxList1.Items[8].Selected = true;
}
}
if (dt1.Rows.Count == 0)
{
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
CheckBoxList1.Items[i].Selected = false;
}
}
}
}</pre>
sahmed4
13-Feb-13 19:21pm
View
The problem is i have an 4 dropdown list controls two of ddlCountry,ddlState in my form and rest of the two is inside edititem template of my gridview control...while editing the gridview control i wanted to populate the list of states based on country selected in edititemtemplate ddlCountry selectedindex change event...once afetr selecting the country when i try populating the states to ddlState of my ddlState inside edititemtemplate is not finding the control instead it's binding up to my ddlState control of my form...I hope my problem is clear please find me the solution i need to populate the staes of ddlState(edititemtemplate) controls on selecting country...
sahmed4
12-Feb-13 3:47am
View
Hi mehdi.. i hope u haven't understand my Question i need to insert a new column between the existing column using T-SQL statements
sahmed4
12-Jan-13 0:16am
View
Hi Mika Wendelius,Maceij Los...I hope i am near to achieve my solution from your help.Let me give you a clear explanation of my requirement.
Whenever any student(s1) logs in and attend an exam from online.At first time in my question table if i have only three questions and who ever the student logs in a system to attend an exam he may be able to attend only these 3 questions which ever is in my question table. In future i have added two more questions in my question table and now totally there are 5 questions and the student s1 has already attended first 3 questions so when next time the student s1 logs in to attend an exam he should be able to view only the updated questions and not those questions (first 3) which he has already attended. I hope it's my requirement is clear enough to understand. Please provide the solution. In above solution of your's will give me the top most record from my question table but if i have added three new questions then still it will highlight me only the latest record from those newly added 3 questions.
sahmed4
21-Dec-12 0:38am
View
see this below updated query
DECLARE @Test VARCHAR(1000), @RecSet VARCHAR(500), @ID VARCHAR(10), @Value VARCHAR(60)
DECLARE @StartingPos INT,@RecPos INT
SET @StartingPos= 1
SET @Test =(select cmp.complexion1 from customerexpectation cmp where cmp.customerid='68572b93-16bd-4764-b75f-3aad35fef04b')
WHILE @StartingPos<=LEN(@Test)
BEGIN
SELECT @RecPos = CHARINDEX(',',@Test,@StartingPos)
SELECT @RecSet=SUBSTRING(@Test,@StartingPos,@RecPos-@StartingPos)
SET @ID=@RecSet
PRINT @ID
-- SELECT CC.CUSTOMERID,CC.COMPLEXION1,CM.ID FROM CUSTOMEREXPECTATION CC
-- LEFT OUTER JOIN
-- COMPLEXION CM
-- ON CC.COMPLEXION1=@ID WHERE CUSTOMERID='68572b93-16bd-4764-b75f-3aad35fef04b'
--
SELECT @StartingPos=@RecPos+1
END
and the Variable @Test consists of values 2,5, and im getting result in Print @ID statemant as 2 and 5 in two indiviual rows..now i need to insert these values in temp table..pls find soln...i hope now my req is clear..
Show More