.net

How to use Data Connection created in Visual Studio in code?

Is it possible to access the Data Connection added to the project in the code? I know that it is possible to access DataSets created using visual designer but I would like to access the connection only. Edit: It is possible to add Data Connection to the project in VS2008 via Tools > Connect to Database. I would like to access this co...

what exactly happens when we use ajax

i am not getting what exactly happens when we use ajax.Page doesn't get refreshed everytime means what? is it related to page_load method or what ...

sql server 2008 - sqlcachedependency without trigger?

I am so puzzled. I am using this open-source snippet. I have a table without any triggers in SQL Server, and yet the SQLCacheDependency is working fine. I thought you needed triggers on the table for it to work?! DateTime localFileTimeStamp = DateTime.Now; DateTime fileTimeStampInDB; ...

NHibernate and Windsor assembly conflicts

Hi, I am having an issue getting Hibernate and Windsor to work together. My setup details are as follows I have two projects -DomainModel -MVCApp I have downloaded NHibernate 2.1.2 and Windsor 2.1.1 I added the following references to DomainModel from the required_Bins folder of the NHibernated download - Antlr3,Iese,log4net and NHi...

MCTS programming language and cheating

Hi 1- Can I select programming language in the exam or I will be forced to learn both VB and C#? 2- Does MS consider testking as cheating. 2- Why testking is considered cheating in some communities? what is the difference between testking and practice exams. Thanks ...

Is DBNull.Value required for nullable types as SqlCommandParameter.Value

Which approach is recommended: void Add(int? value) { command.Parameters.Add("@foo").Value = value; } or void Add(int? value) { command.Parameters.Add("@foo").Value = (object)value ?? DBNull.Value; } ...

Modifying .NET Dictionary while Enumerating through it

Hi, I`m using a Dictionary and I want to change it while I Enumerate through it, but it seems this is not allowed. How can I do this? Thanks ...

In VSTO Excel, how to detect data in cells?

I was wondering if anyone knew how to quickly detect whether there is data in a given worksheet or not, without actually looping through all of the rows/columns of the worksheet to figure this out. I am writing an importer that will import data right into the active worksheet (if it has not been modified), or create a new worksheet and ...

How to set 'Publisher' in a .NET ClickOnce application

I'm publishing a .NET ClickOnce application and when the user installs it the Publisher is set as Unknown Publisher (see below). What do I need to do to change this field? Do I need a valid SSL certificate? ...

How could I ignore bin and obj folders from git repository?

I want to ignore bin and obj folders from my git repository. As I've found out, there is no easy way to do this in .gitignore. So, are there any other way? Using clean solution in Visual Studio? ...

Database abstraction layer design - Using IRepository the right way?

I'm in the process of designing my ASP.NET MVC application and I ran across a couple of interesting thoughts. Many samples I have seen describe and use the Repository pattern (IRepository) so this is the way I did it while I was learning MVC. Now I know what it's all doing, I starting to look at my current design and wonder if it's the...

Using compiler constants in build events

Is there anyway to use compiler constants in Build Events in Visual Studio - VB.NET? (especially in Post-Build events) Scenario If TEST_EDITION=TRUE is defined I want to run an executable during the Post-Build event so if it's FALSE then I'll run something else. This can be used for creating different installers for different editions...

Export SQL Server Database to Access using entity framework

Is it possible to export a sql server database (2008) to a new access database using the Entity framework (or anything else for that matter in code)? I have developed a desktop facing application that connects to a sql sever on a server and my client wants to be able to take snapshots of the database in access to send to people who do...

.NET Pooling IAsyncResult Objects

Hi, Reading through the SendAsync, BeginAsync method illustrations of Sockets, I realized that it was suggested to pool SocketAsyncEventArgs instances saying that it is a better than BeginXX, EndXX async approach since each call creates an IAsyncResult instance. I thought it was not that a great practice to pool objects that can be ins...

How can I design an object to represent all HTML form elements?

Disclaimer: This is a personal project that I'm doing for fun. I'm not looking to use existing libraries since it would take some of the joy out of learning more about wheels. That being said, I'm working on a web spider and I've come to the problem of how to represent HTML form elements with a single object. What I want to do is have ...

Using MVVM design pattern in .Net 3.0

I have been looking into MVVM design patterns with WPF for a project. I have so far looked at MVVM light, MVVM Foundation, and the WPF Model-View-ViewModel Toolkit. I have a requirement to keep it to .Net 3.0 and not 3.5. I was wondering what frameworks outside of the MVVM Foundation samples use the design pattern or something similia...

Lambda expression in C#

Is there a situation where the use of the lambda expression is particularly helpful or its mainly usage is to write less code? ...

Changing the tint of a bitmap while preserving the overall brightness

I'm trying to write a function that will let me red-shift or blue-shift a bitmap while preserving the overall brightness of the image. Basically, a fully red-shifted bitmap would have the same brightness as the original but be thoroughly red-tinted (i.e. the G and B values would be equal for all pixels). Same for blue-tinting (but with...

What is CLR hosting?

What is CLR hosting? What is the use case for that? ...

Why does my IRC bot not connect?

public static string SERVER = "irc.rizon.net"; private static int PORT = 6667; private static string USER = "Test C# Irc bot"; private static string NICK = "Testing"; private static string CHANNEL = "#Test0x40"; public static void Main(string[] args) { NetworkStream stream; TcpClient irc; StreamReader reader; StreamWrit...