Well this would be interesting if I can do what you mention. I can use it for other purposes and will be helpful to me. But in my situation, I can not make a combination of columns unique. Things are like 1. Customer are renewed so the data can be very similar to each other. 2. Some honest mistakes can occur where the same data is added twice. The user can figure it out but I want to stop it from the db end. I am thinking I should change an existing field unique or add a new field which would be unique.
sharp_k
Posts
-
Introduce integerity in the database -
Introduce integerity in the databaseI have a single table called customers that stores all customers information. It has only one primary id field, which is identity. At times it happens duplicate records are inserted. But since the primary ID is the different, the records are actually different. There is no other field in the table that I can make unique. What is the best way to introduce data integrity in the database so that duplicate records can not be inserted in the table. Note that table has more than 80 fields.
-
I am so glad to see the new QA format on CPJust landed on a question via google and found the Stack overflow style QA format. Really happy to see it and planning to use CodeProject (CP) once again.
-
IsUserInRole too slow - ASP.NETThis is great advice. The fact is I have not worked a great deal with roles, profils etc and I just getting to know what providers are. 1. I have about 30 total users (max) 2. I have about 10 roles 3. SQL Server 2005 4. yes 5. No, when any page is access that has IsUserInRole, it is very slow 6. I am not overriding any function but thinking about it now. Something to note, this application was change from time to time so it also has old users which are about the same in numbers but obviously as upgraded the program, we created new users and the old ones are still in the database.
-
IsUserInRole too slow - ASP.NETOk tried it. It did work but it also took 13 seconds to execute. Note that I have tracing enabled.
-
IsUserInRole too slow - ASP.NETIs
User.IsInRole
faster and less expensive than
Roles.IsUserInRole
-
IsUserInRole too slow - ASP.NETI am checking if the user in in role, he is allowed access to the page. If he is not, he is shown the error message. I have not trie User.IsInRole, somewhere I read, it give different result.
-
IsUserInRole too slow - ASP.NETWhat basically the logic is right now, every page check for IsUserInRole and not just for one role. There are pages which can be accessed by two or three roles. If the user is in that role, he is allowed access otherwise not. It does not seem like that wasteful. But since IsUserInRole is slow, it needs to be made better. Ever page you visit is slow just because of it! So I can see now if I use cache even for single user, at least all the subsequent clicks will be faster.
-
IsUserInRole too slow - ASP.NETI am using Page_load currently. The code came from previous developer. There is a lot of calling for IsUserInRole so that definitely can improve performance if I remove them. But I am looking for a more elegant solution now that solves the problem of slow IsUserInRole. If not, your suggestion would be my best bet.
-
IsUserInRole too slow - ASP.NETI dont have SQL profiler. But well made point. Will look into it. The total users in my app is less than 100 anyhow. Shouldn't be taking that long! Will investigate.
-
IsUserInRole too slow - ASP.NETThanks. Did will delete this one.
-
IsUserInRole too slow - ASP.NETWhile debugging my slow application, I found the culprit is
Roles.IsUserInRole
It take from 3 sec to 9 second to execute. I found the reason it through the entire user list and calls other function, but it shouldn't be that slow to what I understand. My question is can it be made faster?
-
IsUserInRole too slow - ASP.NETWhile debugging my slow application, I found the culprit is
Roles.IsUserInRole
It take from 3 sec to 9 second to execute. I found the reason it through the entire user list and calls other function, but it shouldn't be that slow to what I understand. My question is can it be made faster?
-
javascript : submit for via link + "retrieving value of submit button"I think I solved the problem. I introduced a hidden field that acts as a button which accomplishes the purpose.
-
javascript : submit for via link + "retrieving value of submit button"When you submit a form via javascript, (it is already done), the value of Submit button is not set. I want this to be set for security reason and as good programming practice. I tried something like this, that should work but it does not.
document.hiddenform.school.value = 'My School'; document.hiddenform.submitbutton.value = 'My Submit'; document.hiddenform.submit() ;
That is I am setting value of of submit button in javascript. While "My School" text is correctly assigned to the school text field, "My Submit" text is no assigned to submit button. Any one know what is the best way to go about it? I am using link to submit form and i want the submit button to be set as well. Well actually I might go without the submit button but just curious if anyone can help in this case, just for testing. Thanks
-
how to generates indexes for a queryLets say I run a query on a table and it returns the record with ids 2,4 and 6. My id is auto incremented number which is incremented automatically for each inserted record. I dont want to use these ids but rather want to generate my own index which starts for 0 or 1. In this case my indexes should be (1, 2, 3). How can i do it? Thanks in advance. Lets say my table name is 'students'
SELECT * from students
The above code returns the actual id's field which may not be consecutive. I want to generate my own indexes which are in ascending order 1, 2, 3 ...
-
How to print an a 4x4 array in clockwise directionGood to know a little bit about you. I actually looked at your webpage on codeproject but there was not much there except that you are from Italy :-O Well thanks for the little background. Codeproject is my resource for technical questions so I will definitely post here if i need any help. Thanks again.
-
How to print an a 4x4 array in clockwise directionThanks again! I appreciate it. I am definitely a fan of your programming skills. How much of experience do you have in programming btw. You have personnel contact? :)
-
How to print an a 4x4 array in clockwise directionThanks for explaining. I got the idea. This is a beautiful logic but it also requires some arithmetic and pointer skills :) If you could implement it in general arrow notation, that would be great. But of course not required :) You are absolutely right, the rotate array matrix approach would be too much waste of time and computationally expensive. I think this is great logic. I would not have seen it unless it was implemented. Thanks again. I greatly appreciate your help :) BTW Brave for implementing it in such a short amount of time!
-
How to print an a 4x4 array in clockwise directionThis works perfectly! I have not yet understood how it works though but will think on it. I was thinking on the idea to print the top row of the matrix then rotate the matric anticlockwise while removing the top row and printing the next top row and so on. But then I needed a function to rotate the matrix anticlockwise, which was not easy to implement when you consider you have to eliminate the top row as well. Your code is much simpler and very neat. I still have to understand it fully though. What do you think about my idea. Can you explain a little bit of your code. Thanks a lot for sharing :)