.net

Hiding and showing content in ASP.Net based on value

I am looking for an elegant solution for removing content from an ASP.Net page if no data has been set. Let me explain this a little more. I have some blocks of data on a page that contain some sub-sections with individual values in them. If no data has been set for one of the values I need to hide it (so it does not take up space). Als...

MySQL and SQL Server for same application.

What are good ways of achieving this DB agnosticism without actually coding two DAL's? I've heard that the Data Access Application Block is suitable for this. ...

.Net Data Handling Suggestions

I am just beginning to write an application. Part of what it needs to do is to run queries on a database of nutritional information. What I have is the USDA's SR21 Datasets in the form of flat delimited ASCII files. What I need is advice. I am looking for the best way to import this data into the app and have it easily and quickly query...

ActiveMQ .net client locks up

I have written a windows service using the Apache.NMS and Apcahe.NMS.ActiveMQ (version 1.0) libraries. The service consumes messages from ActiveMQ from a vendor server. The service spins up a connection and listens for messages (I handle the OnMessage event) The connection is a transacted connection so I call commit after each message...

Detecting changes in property values of a .NET object?

Hi, I have a form which is used to insert/display and update. In the edit mode (update), when I pass my BO back to the Controller, what is the best possible way to check if any of the property values were changed, in order to execute the update to the datastore? textbox1.text = CustomerController.GetCustomerInformation(id).Name A c...

How to validate .NET dialog items when using automatic DialogResult?

At the moment I have setup a custom ok cancel dialog with a drop down in c#. The ok and cancel buttons use the DialogResult property so no code behind it. What I now need to do is validate the drop down to check it isn't left empty before posting back a dialogresult. Is this possible? ...

How do I separate some properties from the main MSBuild file

Ages ago when I was a java developer I could make separate ant scripts that I would call from my main ant script. I would put properties unique to each environment where my main script would run. I want to do the same thing in MSBuild but I can't find out how to chain MSBuild scripts together. ...

.NET forms authentication cookie not accessible in another application

I have one application which uses the standard .NET forms authentication cookie, now I need to get this cookie from an application hosted on the same domain but one folder down with it's own application. I can't seem to find any trace of the cookie using Request.Cookies.AllKeys, there must be a reason why because when I check to see wha...

Comparing generic list to an array

Why is the generic.list slower than array? ...

Doesn't NHibernate HQL support "with" keyword?

I'm trying to build a HQL that can left join values from a collection, in order to give me the chance of checking "is null" on it. Taken from the example from hibernate manual: from Cat as cat left join cat.kittens as kitten with kitten.bodyWeight > 10.0 doesn't seem to work in NHibernate, since it doesn't recognize the...

What are alternatives to generic collections for COM Interop?

I am attempting to return a collection of departments from a .NET assembly to be consumed by ASP via COM Interop. Using .NET I would just return a generic collection, e.g. List<Department>, but it seems that generics don't work well with COM Interop. So, what are my options? I would like to both iterate over the list and be able to acce...

LinqToSql Producing Different Sql Queries on Different Machines for Identical Code

I have a website built using Asp.net and LinqToSql for Data Access. In a certain section of the site, LinqToSql produces a query that looks like this (from my dev machine): select ... from table1 left outer join table2 on table1 where ... left outer join table3 on table2 where ... Since the connection between table2 and table1 is not ...

Best guide for creating Windows Services in C# .NET?

Hi, all. I'm looking to convert a small .NET console application into a Windows Service. I'd like to build two versions, one using .NET 2.0 and another with .NET 3.5 . Are there radically different approaches that need to be taken, or will the 2.0 version be roughly equivalent to the 3.5 version? Where's a good source of information ...

Writing a more efficient clock function.

I have a clock feature in a VB.NET program that displays the time including the seconds. I currently have a timer constantly polling using NOW. I have to poll the system clock quite often because I need to have the second update in sync with the system clock. Is there a more direct to access the time only when the seconds change? Is th...

How to debug .NET remoting calls?

I have an app with the following basic architecture: A windows service (Service) that registers a .NET type (RemoteObject) for remote access (.NET Remoting). RemoteObject creates non-ThreadPool threads that use the ThreadPool to do IO processing. The size of the ThreadPool must be restricted to a limit for a particular reason. A GUI ap...

Tests Projects In Solution

In .NET should you place unit test projects in with the rest of the solution? Or should there be a test solution that houses all the test projects? We have all the test projects in with our code base solution...it seems a bit cumbersome. What do you usually do? ...

How do I read an MSMQ message from a VB6 app using .NET code?

I am writing a simple xml string to an MSMQ from a VB6 app, but when I attempt to read the message off the queue in C# using the XmlMessageFormatter I get the following error: "Name cannot begin with the '.' character" How do I successfully read these messages using .Net code? ...

VB date conversion

Is there an easy way to convert a string that contains this: Date: Wed, 5 Nov 2008 13:12:12 -0500 (EST) into a string that contains this: 20081105_131212 UPDATE: I ended up using date.tryparse which is similar to tryParseExact except you don't have to specify the format string. I did have to eliminate the () and the EST for this t...

string to char* marshaling

Hi, a strange problem .... I wrote a managed c++ class that has the followig function: void EndPointsMappingWrapper::GetLastError(char* strErrorMessage) { strErrorMessage = (char*) Marshal::StringToHGlobalAnsi(_managedObject->GetLastError()).ToPointer(); } As you can see, this is simple methode to copy the managed string of the l...

C# compiler throws invalid arguments error. Why?

I have a class that contains two methods like these: public String getFoo(Int32 a) { return getBar(a, "b", null); } public String getBar(Int32 a, String b, Int32 c) { //do something return ""; } However when I compile my class I get two errors: The best overloaded method match for getBar(int,string,int) has some invalid argum...