.net

When should I open and close a connection to SQL Server

I have a simple static class with a few methods in it. Each of those methods open a SqlConnection, query the database and close the connection. This way, I am sure that I always close the connection to the database, but on the other hand, I don't like to always open and close connection. Below is an example of what my methods look like. ...

Is it possible to use .NET Reactor with ClickOnce deployment?

After reading this post and encountering the same issue (when attempting to build the manifests): MSB3171: Problem generating manifest. Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format. I would like to know if anyone has had success using .NET Reactor (Encryptio...

Example of an Abstract Factory in .NET

Are there any good examples of the "Abstract Factory" in the .NET BCL? ...

Dynamic Language Runtime and CLR - what's the point of DLR?

From wikipedia's entry on DLR, it look like the purpose of DLR is for using language like Python, Ruby...etc. Is that all to DLR? Is there any other benefits and why do you want to pick IronPython over C# for say ASP.net project or Winform app? ...

DataGridView binding from list problem

I have a List of customers that I'm trying to bind to a DataGridView. I have two data classes that looks like: public class Customer { public string Name { get; set; } public AddressDetail Address { get; set; } } public class AddressDetail { public string StreetAddress { get; set; } public string City { get; set; } ...

How to Mix different compiler versions programs in visualstudio:?

HI our total project had Built on vs2003.earlier they have used SQLDMO in teheir project.Now we have palnned to use SQLSMO instead which must have .NETFRAMEWORK 2.0.But as of my knowledge vs2003 runs under .netframework1.1. Now my question is how to mix these two. my thinking is in my machine i have alresdy .NETFRAMEWORK 2.0 inst...

Troubleshooting with a .NET application that doesn't start

I have a recurrent issue with .NET applications that don't start (on others systems than mine). The fact is that I cannot, unfortunately, always create a smoothly running package. Therefore I often have to send a ZIP file of my Debug or Release folder. My real problem is that these applications doesn't tell WHY they're not starting. I j...

Displaying only selected headers in DataGridView

Hi! How can I display only selected headers in DataGridView control? For example I have DataTable with headers ("Name","Age","Status"), but I'd like to omit "Age" column when displaying. Thanks! :) ...

Where are the .Net data types stored?

Hi, Where are the .Net data types stored? ...

How to compile using framework libraries?

I have wrriten a managed code for SMO application.How can i comiled it using .NETFRAMEWORK2.0. i dont wnat to use visulastudio due to certain limitataions. how can i do this. can nay body help me in this regard. msbuild.exe TestMsBuild.sln /:t Rebuild /:p configuration=release gives error as TestMsBuild.sln : Solution file error ...

How to place a .net UserControl on a c++ cdialog in visual studio 6

Hi My task is pretty simple create a .net usercontrol and use it in a old visual studio 6 proejct. I have createt the usercontrol (its just a user control with a label), I then followed this guide (http://support.microsoft.com/kb/828736) and it seems to work fine. But how can I display the usercontrol? Do I have to use CreateControl, a...

Is SecureString secure?

Is there any guidance on actually using the SecureString in a secure manner? I don't see there being any way to even create the secure string in the first place, as you are going to need it to be typed in from a textbox at some point. ...

Upgrading Enterprise library - v1.0 to v4.1

I have an application currently using the 1.0 version of ent-lib, which I am trying to use with ent-lib 4.1. It is currently using these blocks: Common, Data, Logging, Security.Cryptography, Security and Configuration. I have so far been sitting with the source of both ent-lib 1.0 and 4.1 trying to find out which classes correspond to wh...

XML UTF-8 encoding checking

Hello everyone, I have an XML structure like this, some Student item contains invalid UTF-8 byte sequenceswhich may cause XML parsing fail for the whole XML document. What I want to do is, filter out Student item which contains UTF-8 byte sequences, and keep the valid byte sequences ones. Any advice or samples about how to do this in ....

Could validationKey and decryptionKey be found by brute force from encrypted cookie value?

I am using the following code to generate an encrypted token: var ticket = new System.Web.Security.FormsAuthenticationTicket( 2, "", DateTime.Now, DateTime.Now.AddMinutes(10), false, "user id here"); var cipherText = System.Web.Security.FormsAuthentication.Encrypt(ticket); This code uses the key and algori...

How can I tell my ASP.NET application to use any version of a strongly named assembly?

I have an ASP.NET application that uses a custom .NET library (a .DLL file). That .DLL file is strongly named. The library has frequent small updates, and I would like to be able to update this .DLL without recompiling the application. The application has to be precompiled because I do not want to give the source of it to my customers (n...

What should the out value be set to with an unsuccessfull TryXX() method?

I'm implementing a TryParse(string s, Out object result) method. If the parse fails, I would like not to touch the out parameter so any previous result will remain intact. But VS2k8 won't let me. I have to set the value of the out object no matter what. Should I just put result = result for the sake of pleasing the compiler? Am I missin...

Primary Key count Count in LINQ very slow

I thought LINQ to SQL was tuned for performance? The following LINQ to SQL for counting is very poor Dim uniqueFactors As Integer = db.LargeTable.Distinct.Count produces: SELECT COUNT(*) AS [value] FROM [dbo].[LargeTable] AS [t0] WHERE ([t0].[ID] % @p0) = @p1 How every the fastest way to count the number of records based on a prim...

How to send a hashtable to an asmx webservice?

I'm trying to send a hashtable to my webservice using JSON. However, you can't send a dictionary-type object (for some reason). A solution that apparently works is "List(Of KeyValuePair(Of String, String))", as output anyway: <WebMethod()> _ Public Function test() As List(Of KeyValuePair(Of String, String)) Dim ret As New List(Of K...

What are salesforce.com and Apex like as an application development platform?

I have recently discovered that salesforce.com is much more than an online CRM after coming across a Morrison's Case Study in which they develop a works management application. I've been trying it out with a view to recreating our own Works Management system on the platform. My background is in Microsoft and .Net, and the obvious 1st ch...