.net

System.Data.DataRowView exception when inserting row into SQL Server

Im getting an error No mapping exists from object type System.Data.DataRowView to a known managed provider native type every time i click my button.. here's my code.. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim insertCommand = <xml> INSERT INTO returns( ...

convert text xml to binary xml in .NET 4

Is there any way to do that in .NET 4, may be with XmlDictionaryWriter? ...

How is the boxing/unboxing behavior of Nullable<T> possible?

Something just occurred to me earlier today that has got me scratching my head. Any variable of type Nullable<T> can be assigned to null. For instance: int? i = null; At first I couldn't see how this would be possible without somehow defining an implicit conversion from object to Nullable<T>: public static implicit operator Nullable...

Simulate NavigateAndWait with a WebBrowser using yield return

I'm working on an application that it's been giving me some trouble, partly because of a function I made called NavigateAndWait(string url) that navigates and then waits in a loop like this: while(!DocCompleted) Application.DoEvents(); DocCompleted is a bool that changes to true whenever DocumentCompleted is called. I keep reading eve...

Get files from directory with pattern.

Hello, Does it possible to get for ex. .c and .hfiles from directory. Usage of Directory.GetFiles("C:\", ".c;.h"); does not work. It's too bad to invoke Directory.GetFiles(...); twice.. :( Thanks. ...

Can .NET dissemblers like Reflector access the comments in the origial source code?

the comments are not XML comments, just normal comments ...

WMI Get the Last Logged in User

Using WMI how can I get the last logged in user for a computer. Currently this is what I have for some reason its returning null. Any ideas why and is this the correct way to get the last logged in user. (NOTE: I am using it on Windows 7 machines) Using System.Management; var scope = new ManagementScope(@"\\COMPUTER_NAME\root\CIMV2"); ...

Twitter App using C# using OAuth token

I'm trying to get a workaround so that i don't have to press the Allow button everytime when I make use of the Twitter API. if (Request["oauth_token"] == null) { //Redirect the user to Twitter for authorization. //Using oauth_callback for local testing. oAuth.CallBackUrl = "http://localhost";...

Custom Structure that can be assigned Nothing and/or DBNull??

Hi Guys, Please can any one advise me if it is possible to decalre a custom structure that can be assigned Nothing and / or DbNull.Values, and also can be instanciated as Nothing? What I am looking to do is ceate a custom DateTime object that can recieve a DBNull.Value from a database query and also start life as Nothing. IS this possi...

Posting info to Twitter with a known username / pass and the Oauth token without having to grant access

I'm using C# to build some functionality for a website. They want to twitter a message to their account at the point when a new vacancy gets added to their website. I face the issue that when i try to do this using the OAuth token approach i have to grant access to the application everytime. I want this all to work automatically without ...

first web service from WSDL with .NET

Hi, I have a WSDL file and I want to create a SOAP server process from that file using visual studio .NET. Until now I have created a cs file from the WSDL with the following command wsdl my.wsdl my.xsd /language:CS /server Now I want to start a server process at a custom port (eg port 10000) that will send the responce back to my cl...

Inheritance and static properties

I don't understand the following phenomenon, could someone explain me please what I got wrong? public class BaseClass { public BaseClass() { BaseClass.Instance = this; } public static BaseClass Instance { get; private set; } } public class SubClassA : BaseClass { public SubClassA() ...

Running NHibernate queries without joining

I have Fluent mappings that maps a fictional class Customer to a list of Orders. Now I want to fetch all Customers from the database without loading Orders. Can this be specified somehow in the query/criterion/etc, or is LazyLoading the only solution? Fictional classes: public class Customer { public virtual int Id { get; set; } ...

Amazon EC2 for WCF Windows Service

Dear Gurus I have a Sync Services built using .Net WCF, .net 4.0,SQL Server 2008 and hosted in a windows service. Following are some custom implementation we have done; Custom DB Connection Pooling, filled on the start of Application, and there is a cleanup thread as well which runs through out the life cycle of application. Custom ...

Avoid serializing certain properties in REST services

I have a .Net application split in client and server sides, and the server provides REST services (using WCF). I have services definitions like these: [WebGet(UriTemplate = "/Customers/{id}")] Customer GetCustomerById(string id); [WebGet(UriTemplate = "/Customers")] List<Customer> GetAllCustomers(); The Customer class and its friend...

.Net LINQ query syntax vs method chain

Hy Is there any performance difference between: (from item in collection where item.id == 3 select item) and collection.Where(item => item.id ==3) In general is there any performance difference between the linq syntax and the method chain? ...

Join 2 lists in one

I am new in .NET > 2 I have List<Dog> dogs; List<Cat> cats; List<Animal> animals; I need to join dogs and cats in animals. I know that there should be a elegant way to do it using LINQ or stuff from .NET 4, isn't it? My Initial variant: animals.AddRange(dogs); animals.AddRange(cats); ...

Third-party referenced dll not been copied to build out.

Hi, I have a thirdparty .net dll being reference and used by my dll/class library project “A”. My console app project “B” references project “A”. My problem is the thirdparty dll is not being copied to the build out for console app project “B”. What’s the problem here? The thirdparty dll ref’d in my dll/class library is set to LocalCo...

Working with Grid using BackgroundWorker

I have a GridControl which I populate using a BackgroundWorker. Then I'm using another BackgroundWorker to perform some calculations on the dataset which is the datasource of the GridControl. As I'm trying to do this a cross thread operation on the GridControl error is thrown. I'm unable to understand that despite not performaing any ope...

SOAP request namespaces .NET

When my client makes a request via web service, the generated SOAP message looks like this: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org /2001/XMLSchema"><soap:Body><myMethod xmlns="htt...