|
I am not too sure about this, but depending on the user permissions I think SELECTs can work and UPDATEs can fail.
1. Try to connect to the database. If successful, user can login
2. Try to read a record (with SELECT). If successful, user has read access
3. Try to insert or update a record. If successful, user has write access
If only the third test fails, the user has read-only access.
|
|
|
|
|
Unfortunately i can't push an insert or update to production databases in order to determine if the user has write access, so that brings me back to needing to query some sort of users table in sql plus. Do you know where that might be?
|
|
|
|
|
Hi everyone,
The original idea of the new library(MRCopy) that I want to create is to offer the possibility of saving state of the client application. How do it? Using the memento pattern and reflection and serialization...
It’s a simple idea that need to be worked but I think that it goes forward is something helpfully for any Windows or web application.
Any help or suggestion will be welcome.
Thanks in advance
|
|
|
|
|
if any one have in his mind ideas for Project Graduauion in IT engineering fuculty please dend me it and I will be very thankfull for him
my e-mail
michaelqog_71@hotmail.com
|
|
|
|
|
michaelqog wrote: if any one have in his mind ideas for Project Graduauion in IT engineering fuculty please dend me it and I will be very thankfull for him
my e-mail
michaelqog_71@hotmail.co
Spell Checker?
|
|
|
|
|
Or a screen scraper that grabs email addresses of bulletin boards and spams them?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
dino2094 wrote: Spell Checker?
I'd hate to see the dictionary they build for it.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Hi Fellow;
I have certain ideas for graduating project.
1-Develope a lazer based securit system for a safe room...Laser ligts are spread inside the room,whenever some one tries to enter into the room the sensor senses the persons...that some one has entered into the room.
2-develop a mobile based software that can detect the location of the calling persons.
3- Develop the steganographic application that hides secret messages into images,audio or video..etc.
For further detail .contact me: rao282002@yahoo.com
I am getting B.S. degree in Computer Science.And want to enhance career in Software development.
|
|
|
|
|
Ask your professors for some insight. That is what they are there for.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
I store an object to the clipboard like this
Clipboard.SetDataObject(CustomDataObject)
and retrieve it like this:
<br />
if (Clipboard.ContainsData("MyNameSpace.CustomDataObject"))<br />
{<br />
CustomDataObject objectName = (CustomDataObject)Clipboard.GetData("MyNameSpace.CustomDataObject");<br />
}<br />
The problem is that if (Clipboard.ContainsData("MyNameSpace.CustomDataObject")) evaluates true but when CustomDataObject objectName = (CustomDataObject)Clipboard.GetData("MyNameSpace.CustomDataObject"); is carried out objectName is assigned null. I read through the documentation on the Clipboard.GetData method and it says it only returns null if the specified format isn't on the clipboard. But it clearly said that format WAS on the clipboard, that's contradictory!
Oh and no error is given so Clipboard.GetData is working properly I suppose but returning null nonetheless.
|
|
|
|
|
1. I've created a userControl that contains a Label and a TextBox.
2. I programmatically create a number of TabPages and add them to a TabControl.
3. On each TabPage I programmatically add a number of my userControls giving each control a unique name
and I pass information to the control to adjust the label.
This is all based off of an xml file. So I read this xml file and determine how many tabs and how many controls I need to
add to each page. The user will then edit the data in the textbox if needed.
Once the user is done and click save, I need to go through each control and get the value that the user entered. Then update my xml file with the new data.
I can not figure out how to loop through and get the controls off of each tab.
Hopefully I've explained this clearly.
Thanks in advance for any help!!!
Bob
|
|
|
|
|
foreach(TabPage tp in tabcontrol1.TabPages)
{
foreach(Control ct in tp.Controls)
{
if(ct.GetType() == typeof(TextBox))
{
}
}
}
This would be ok for the textboxes inside the tabpage, if you have a groupbox or panel, you will have to add one more loop to find the controls inside them.
Is it not possible for you to directly access the text box? You are creating the textbox control from the xml list and you should have the textbox Name?
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Good point, you interate through your XML file to build the controls, so you should be able to go through it again to know where to get values back out.
|
|
|
|
|
Personally I would modify the test to be
if ( ct is Textbox ) ...
and others on here would use
TextBox temp ;
...
if ( ( temp = ct as TextBox ) != null ) ...
any of the three should serve you well.
|
|
|
|
|
I have used if ( ct is Textbox ) kind of code also, but I really haven't researched the difference of this vs that. Does it improve performance or is it just a better way of coding it?
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Perhaps not in this case.
But if the actual control were of some derived type of TextBox (e.g. MyTextBox) then the is would return true whereas the test for typeof(TextBox) would return false .
as would also work as expected, but the downside, in my opinion, is that as requires the declaration of a reference variable (not a big deal) and the assignment of that reference within the loop when there really is no need for the reference at all, except perhaps to make the code more readable.
I still haven't found a worthwhile use for as .
|
|
|
|
|
Anytime you actually need to cast to a type, as is a nice shortcut that never fails, just leave the instance null if it doesn't work. "doesn't work" sounds a lot like "fails", you know what I mean...
|
|
|
|
|
Yes, but do you really need the additional reference and is it worth the (repetitious) assignment?
In cases like this, is and as may perform about equally; as requires more assignments and is requires more tests. (Perhaps?)
I'll have to try to make up a test program.
|
|
|
|
|
In this case, no you don't need the extra object on the heap. But in situations where you actually need the case, and aren't just testing it's type, it is handy. Of course you are only holding the reference for a short time, but in THIS case where it's not necessary, that's just more work for the CG.
|
|
|
|
|
Preliminary results confirm my theory:
as works well with a homogenous collection
is works well with a heterogenous collection
But cast/catch/ignore also works well with a homogenous collection, at times even better than as ! (Not that I recommend it... much.) It is horrible with a heterogenous collection.
On the other hand, as doesn't work with value types, but I've had success testing it with nullable types.
-- modified at 23:52 Tuesday 17th July, 2007
Whoops, need to add that the if ( o.GetType() == typeof(sometype) ) method is faster than both is and as , but at the cost of not checking the inheritance tree.
|
|
|
|
|
Hello,
Thanks for the test results!
PIEBALDconsult wrote: that the if ( o.GetType() == typeof(sometype) ) method is faster than both is and as
Wow, I have not seen this comming!
PIEBALDconsult wrote: But cast/catch/ignore also works well with a homogenous collection, at times even better than as ! (Not that I recommend it... much.) It is horrible with a heterogenous collection.
Yep, it is the Exception calls, which makes it so expensive I think!
Again thanks for taking time to test it.
All the best,
Martin
|
|
|
|
|
PIEBALDconsult wrote: I still haven't found a worthwhile use for as.
Generally if I need to know whether a variable is of a particular type, I need to use some method of that type that isn't in the base type. So for example, if I wanted to select all the text in the textboxes on a form, where the form has other types of control as well, I'd write:
TextBox tb;
foreach( Control ctl in Controls )
{
if ( null != ( tb = ctl as TextBox ) )
{
tb.SelectAll();
}
} Using as saves performing the type check twice: once to get the result of is , and again to perform the cast.
|
|
|
|
|
I understand that, I just wonder if trading a test for an assignment is worthwhile, in some cases it may well be, but perhaps not in such a simple example. In your example, if you perform a number of operations on tb, then you may well see better performance by having the one assignment rather than a bunch of casts.
|
|
|
|
|
if (null != Something) {} looks really strange to me for some reason.
|
|
|
|
|
Oh, well then try the cast and catch/ignore the exception.
|
|
|
|