.net

How To Install A Windows Service In .NET

I have created a console application in .Net 2.0 (C#) and want to create an installer that will install the application as a Windows Service. I have never created an installer before but I am reading a few articles on the subject. I would appreciate any suggestions or links from those with some experience in this area. Thanks. UPDATE...

Update subtotals in excel files

I using the OpenXML library to take a datatable and paste it into a pre formatted excel file. This works fine. The problem I have is there is a subtotal row at the top of the pre-formatted excel file, that is set to subtotal each column of this data (so there is a subtotal at the top of each column). When I open the excel file after it...

Why does a reference type is not initialized to null ?

Check this code.. string str; if (str.Contains("something..")) { } Compiler throws this error for this code Use of unassigned local variable 'str' Why does a reference type is not initialized to null ? Just want to know out of curiosity. I'd also want to know what happens for code below. how does this assignme...

How to select a word from paragraph in a single right click?

Hi Techies@StackOverFlow, i am researching on a logic, by which i can select a text in a single right mouse click. What I want to say is that , I want to implement, the double click text selection, but in a other way that is in single click and right click. For example if you double click on the text displaying anywhere on this web, the...

EditTemplates and related objects with MVC2

I am learning MVC using the v2 release with Entity Framework v4. Let’s say I have 3 objects Game, Points and Players. They are related in the following manner: Game has points and the Points can have a player associated with them ( 1 Game to many Points and a Point object can have one Player). I am attempting to use the EditTemplates...

What should be the lifetime of an NHibernate session?

I'm new to NHibernate, and have seen some issues when closing sessions prematurely. I've solved this temporarily by reusing sessions instead of opening a session pr transaction. However, I was under the impression that opening sessions each time you need them was the recommended approach for session lifetime management. No? So; what is...

SSIS Object Model - Excel Connection Manager Error On 64bit Machine

I have a SSIS package which reads an Excel File (Data Flow Source) and transfer the data to SQL Server using OLEDB Destination Data Flow Item.This package is executed by .Net Application using the SSIS Object model. The package stored in a file system within the application subfolder. The package works fine on my development/test machin...

Is it possible to combine the Sync Framework with the Entity Framework?

Before I start (re)designing my app, I would like to know beforehand: is it possible to compbine the sync framework with the Entity Framework? We are planning to use SQL Server only (for now). Are there any known issues? Thanks for your reply. Bart ...

Strange increase in email size using SMTP class to send an email as opposed to outlook

I am sending an email with an attachment using the following Code Dim msg As New System.Net.Mail.MailMessage(req.EmailFrom, req.EmailTo) Dim att As New System.Net.Mail.Attachment("C:\Documents and Settings\michaelr\Desktop\1216259.pdf") With msg .Attachments.Add(att) .Body = req.Em...

.net CodeGenerators?

I need a code generator that: is open source will run in medium trust where templates are either compilable or can be embeded as resource files. Webforms will not work because of 2 and 3. If I use virtual path provider then it runs only in full trust; if I run them as regular webforms, then I have to provide .ascx files witch is not...

How to get predefined paper size by PaperKind

I need to get paper size by System.Drawing.Printing.PaperKind. Are there any predefined values? I don't want to hardcode or calculate paper sizes, I just want to get it programmatically. Thanks. ...

How can I codegen classes like this in C#?

I have multiple classes in a project that are exactly the same except for the name of the class. Basically, they represent glorified enums loaded at runtime from config files. The classes look like this: public class ClassName : IEquatable<ClassName> { public ClassName(string description) { Description = description; } ...

SqlDependancy does not work

Hi I am trying to create a SQLDependency for enterprise library, there is something strange that onChange event never fired. For SQLServer2005: Service Broker is enabled. CLR integration is enabled. The query is a simple select statement on user defined table, the query is wrapped in sproc. I have been told that I should find th...

MvcApplication.Error Not Firing (global.asax)

Hi The MvcApplication.Error event in my MVC application will not fire. I have the following in web.config: <system.web> <customErrors mode="Off" /> ... And the following event defined in global.asax: Public Sub MvcApplication_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error Dim lastErrorWrapp...

What is the OracleType of ROWNUM

I am trying to parameterise all our existing sql, but the following code is giving me a problem: command.CommandText = String.Format("SELECT * FROM({0}) WHERE ROWNUM <= :maxRecords", command.CommandText); command.Parameters.Add("maxRecords", OracleType.Int32).Value = maxRecords; The error reported is "ORA-01036: illegal variable name/...

Need I remove controls after disposing them?

.NET 2 // dynamic textbox adding myTextBox = new TextBox(); this.Controls.Add(myTextBox); // ... some code, finally // dynamic textbox removing myTextBox.Dispose(); // this.Controls.Remove(myTextBox); ?? is this needed Little explanation Surely, if I Dispose a control I will not see it anymore, but anyway, will remain a "Nothing"...

What are some good questions to ask a potential consultant w/out insulting them?

We're looking at possibly outsourcing some development to a local consultant, what type of questions would you ask during an initial meeting? We're potentially looking to have them build some basic webapps in ASP.NET and SQL Server 2008. Some of the other questions here are geared toward a new employee who may or may not have a lot of...

How to resolve local DTDs without System.Xml.Utils.Dll(XmlPreloadedResolver)?

I use an external DTD to validate my xml files. Since the XmlReader seem to look for the DTD only in the folder where the xml file is, I need to somehow tell the reader to look into a specific folder where my dtd's are. I though of XmlPreloadedResolver to solve this but I cannot find System.Xml.Utils.Dll in the GAC. Isn't this a standa...

Clean user HTML in .net

My C# site allows users to submit HTML to be displayed on the site. I would like to limit the tags and attributes allowed for the HTML, but am unable to figure out how to do this in .net. I've tried using Html Agility Pack, but I don't see how to modify the HTML, I can see how to go through the HTML and find certain data, but actually g...

Implement Dispose(bool) on a UserControl

How to implement the Dispose(boolean) at a UserControl... when the VS Designer already implemented it with a DebuggerNonUserCode attribute? Will my modifications on this method removed? (code from UserControl.Designer.vb) <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) ...