The easiest way to get a connection string to do what you want is to use the Universal Data Link dialog. To do this:
Create a new text file on the desktop
Rename it to 'access.udl' (the icon should change to a computer in front of a table)
Double-click the icon
You should now get a property sheet labelled 'Data Link Properties'.
Go to the Provider tab and select the Microsoft Jet 4.0 OLE DB Provider. Go to Connection and browse to the database you want to open, then ensure the username and password are correct. Choose 'Test Connection' to check you're all right so far. On the Advanced tab, under Access Permissions uncheck Share Deny None and check Share Exclusive. Click OK.
Now open the .UDL file in Notepad. It should look something like:
; Everything after this line is an OLE DB initstring
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\MyDB.mdb;Mode=Share Deny Read|Share Deny Write;Persist Security Info=False
I hope that shows alright on your browser; CodeProject converts [semicolon][P] into a smiley...;P
Copy the initialisation string into your code, and you should be done.
I'm having problems figuring out how the read the RSA keys from either the KeyFile.snk file generated from sn.exe -k KeyFile.snk or from our signed assembly that uses that KeyFile (which would be preferred). Does anyone have any ideas how I can read these in? About the only method I found was to create an RSAParameters struct and fill it with the base64-encoded data from the public key, but I'd have to dig into RSA a little to figure out the byte alignment and what not. I don't mind doing that, but I'm hoping there's already a method or something that does this in the .NET Framework class library. Anyone know of any?
Reminiscent of my younger years...
10 LOAD "SCISSORS"
I've got a class called RowView derived from UserControl, which is itself the parent of another class (AuthorView).
RowView has a public property Data. Since RowView should never be instantiated directly (it's a pseudo-abstract class) it doesn't implement Data, it simply throws a NotSupportedException. My AuthorView class does implement Data.
Now my problem is that whenever I try and 'design' AuthorView in VS .NET the designer tries to access RowView.Data, which throws an exception.
So my question is, how do I stop VS .NET's designer from attempting to access Data. I've tried settig the Browsable attribute to false in RowView.Data, but it doesn't help.
I can post up some code if that'll help clarify the situation.
Anyone know how I can get a control to validate itself?
I have a nice event handler for Validating which changes the colour of a textbox if it's contents aren't suitable. I'd like the controls to initially start out in the correct state, but at the moment they only validate themselves if I focus on them then defocus. Any ideas?
If you have small number of controls to validate It is a fine idea to do so with a schema like: (OnFocus - OnBlur)
But if the number of controls is large say 20-25 controls then it is always a good idea to validate controls using a seperate routine.
If you want your controls to be self sufficient you can derive them from existing controls then override and add new properties.
Override the required events (e.g. Focus etc...)
Provide a Delegate
Add new event handler
And do any thing you want in the handler
It doesn't have to be super-secure or anything (I don't care about Ctrl-V etc) cause I validate the control's Text later anyway, it's just a quick and easy way to persuade my lovely users to only enter numbers.
So I was just wondering if anyone can spot any usability problems with this? I'm not worried about
I know I'm still calling OnKeyPress(). It seems to work that way, because e.Handled = true. I wasn't sure wether to call it or not, I figured that it was best to call it just in case the Framework has to do some kind of housekeeping.