PlausiblyDamp
Administrators-
Posts
7016 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by PlausiblyDamp
-
Problem from .NET 1.1 to 2.0... (Overload resolution failed...)
PlausiblyDamp replied to bungpeng's topic in General
Define a common interface that both classes implement and declare your variable as that interface. Interface IExample Sub ExampleSub() Function ExampleFunction(ByVal exampleParameter As String) as String End Interface Class ExampleOne Implements IExample Public Function ExampleFunction(ByVal exampleParameter As String) As string Implements IExample.ExampleFunction return string.Empty End Function Public Sub ExampleSub() Implements IExample.ExampleSub End Sub End Class Class ExampleTwo Implements IExample Public Function ExampleFunction(ByVal exampleParameter As String) As string Implements IExample.ExampleFunction Return String.Empty End Function Public Sub ExampleSub() Implements IExample.ExampleSub End Sub End Class You can then use this like Dim ex As IExample If True Then ex = New ExampleOne Else ex = New ExampleTwo End If ex.ExampleSub() -
Problem from .NET 1.1 to 2.0... (Overload resolution failed...)
PlausiblyDamp replied to bungpeng's topic in General
If you have a variable called 'Con' and the two options you present both assign a database connection to it (which means they implement IDbConnection) why would 1) I assume it was meant to hold anything other than a database connection or 2) you want to store anything other than a database connection in it? -
Problem from .NET 1.1 to 2.0... (Overload resolution failed...)
PlausiblyDamp replied to bungpeng's topic in General
As a quickie - you could declare Con as System.Data.IDbConnection rather than object, at least then you will get intellisense to help you. -
Not sure if it can be done directly within visual studio but with the command line tools (resgen.exe, al.exe and sn.exe) you should be able to compile the resx files into resource only assemblies and then install them into the GAC.
-
How to filter a dataset in a For...Each loop?
PlausiblyDamp replied to Agent707's topic in Database / XML / Reporting
Could you not use a DataView to filter the DataTable to the values you need and then loop through those rows rather than doing the filtering yourself as part of the loop? -
http://www.xtremedotnettalk.com/showthread.php?t=79544 might be worth a look as it discusses this issue.
-
Alternatives to Crystal Reports.
PlausiblyDamp replied to mike55's topic in Database / XML / Reporting
If you use SQL Server then Reporting Services are well worth a look, especially the 2005 version. Not sure how well it handles dynamic images though - do you mean loading images from a database or similar? -
Keep system.threading.timer from being GC (garbage collected)
PlausiblyDamp replied to jayy66's topic in General
Where is the above code being run from? (button click, form load etc.) If the variables timerDelegate and checkInboxTimer are only declared within a single routine then they will go out of scope and be eligble for collection as soon as the routine exits. -
If you are using .Net 2 then you could assign a validation group to the controls - controls in the same group trigger validators in the same group only. If .Net 1 / 1.1 then there isn't any simple built in solution I'm afraid.
-
tmpString contains an array but it is returned as an object, you will need to cast the result of tmpString to an Arraylist and then access those elements. Try something like ((ArrayList) tmpString[i])[0].ToString() //or more explicit ArrayList tmp = (ArrayList) tmpString[i]; string s = tmp[0].ToString();
-
try something like tmpString[i][0].ToString() and see if that does anything. In their sample the variable row is an array.
-
tempString doesn't contain strings - only just looked at your original post, it looks like it contains an array of DataRow objects. Is that right?
-
tmpString[i].ToString()
-
If the ISA boxes are currently being used as a firewall then you would need to configure them to allow traffic to / from the remote site's subnet. Are the gateway devices also acting as firewalls and connected live to the internet?
-
Generally it is better to provide your own Insert / Update / Delete commands rather than rely on the CommandBuilder as you have far more control over exactly how the operations are performed. The limitation on not modifying / needing to include a primary key wouldn't exist if you provided your own statements.
-
.GetHashCode() doesn't perform a hash of the value - you need to use one of the classes under System.Security.Cryptography instead. Why do you not get the vb app to generate the new password, hash it and then send that hash to SQL rather than requiring SQL to perform the hash?
-
String concatination... which is the best way??
PlausiblyDamp replied to Agent707's topic in General
As an aside concatenating strings to make SQL statements isn't that good a plan - it can be error prone when dealing with certain data types (dates being a good example) and can be a major security risk due to the potential of injections. Parameterised commands or stored procedures are a far better way to go. -
Just to check something - if you go to the Visual Studio Command prompt on each ofthe 2 servers and run sn -Vl does either list anything?
-
String concatination... which is the best way??
PlausiblyDamp replied to Agent707's topic in General
Just did the following in a simple app string s1 = "Test "; s1 += "more test "; s1 += "even more test."; string s2 = "Test " + "more test " + "even more test"; and checked the reultant IL and got IL_0001: ldstr "Test " IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: ldstr "more test " IL_000d: call string [mscorlib]System.String::Concat(string, string) IL_0012: stloc.0 IL_0013: ldloc.0 IL_0014: ldstr "even more test." IL_0019: call string [mscorlib]System.String::Concat(string, string) IL_001e: stloc.0 IL_001f: ldstr "Test more test even more test" IL_0024: stloc.1 so for doing straight string building the second is a lot quicker as the compiler optimises the entire thing away. If you are concatenating variables into the string then it will do it's best to optimise as the following C# and IL show - int i = 43; string s1 = "Test "; s1 += "more test "; s1 += i.ToString(); s1 += "even more test."; string s2 = "Test " + "more test " + i.ToString() + "even more test"; becomes IL_0001: ldc.i4.s 43 IL_0003: stloc.0 IL_0004: ldstr "Test " IL_0009: stloc.1 IL_000a: ldloc.1 IL_000b: ldstr "more test " IL_0010: call string [mscorlib]System.String::Concat(string, string) IL_0015: stloc.1 IL_0016: ldloc.1 IL_0017: ldloca.s i IL_0019: call instance string [mscorlib]System.Int32::ToString() IL_001e: call string [mscorlib]System.String::Concat(string, string) IL_0023: stloc.1 IL_0024: ldloc.1 IL_0025: ldstr "even more test." IL_002a: call string [mscorlib]System.String::Concat(string, string) IL_002f: stloc.1 IL_0030: ldstr "Test more test " IL_0035: ldloca.s i IL_0037: call instance string [mscorlib]System.Int32::ToString() IL_003c: ldstr "even more test" IL_0041: call string [mscorlib]System.String::Concat(string, string, string) IL_0046: stloc.2 For anything other than trivial string concatenation you would want to investigate the StringBuilder class though, or even see if there is a way to remove the need for concatenation anyway (it can be a security issue as well as a performance one). Also String.Format(...) is worth a look as it can make this far simpler in terms of your code and can often be localised far easier than building the strings by hand. Out of interest what kind of strings are you building this way? -
No - a service cannot display any UI stuff as it has it's own desktop and this is where the UI would appear rather than the desktop of a logged on user (if there even is a logged on user).
-
The service would be set to auto-start and would therefore be automatically started when the server was rebooted. The UI would be a separate application that would be launched either on demand by a user or as part of their start-up group (or similar).
-
Services run under their own desktop - any forms they display will be displayed on this desktop and not visible to any other logged in user. You would need to create a separate application that runs under the user's profile and communicates with the service.
-
You would just need to check if Request.UrlReferer is nothing before trying to convert it to a string, if you haven't been referred then it won't be set.
-
Populating a CheckedListBox from a directory
PlausiblyDamp replied to bjwade62's topic in Windows Forms
System.IO.Directory.GetFiles will return a list of files, just add them to the listbox. -
There is a difference between checking multiple entries and selecting multiple entries. Select refers to the listbox behaviour of selecting multiple entries by use of the ctrl or shift keys.