.net

how to serialize a DataTable to json or xml

Hello, i'm trying to serialize DataTable to Json or XML. is it possibly and how? any tutorials and ideas, please. For example a have a sql table: CREATE TABLE [dbo].[dictTable]( [keyValue] [int] IDENTITY(1,1) NOT NULL, [valueValue] [int] NULL, CONSTRAINT [Psd2Id] PRIMARY KEY CLUSTERED ( [keyValue] ASC )WITH (PAD_INDEX ...

Is there a way to tell .NET where to look for the user settings file?

Basically multiple instances of our application will be launched but they need to have separate user settings. We currently have use "user settings" for that, and it works fine for a single instance (per windows user) but we would like to be able to launch multiple instances with say a settings path passed in via command line. Is there...

Subsonic 3, MySql, System.Collections.Generic.KeyNotFoundException

[WebMethod] public string GetAuthToken(string username, string password) { var db = new LogicDB(); //var results = from u in db.Users // where u.Username == username && u.Password == password // select u; User u = db.Select .From<User>() .W...

Forcing XDocument.ToString() to include the closing tag when there is no data.

I have a XDocument that looks like this: XDocument outputDocument = new XDocument( new XElement("Document", new XElement("Stuff") ) ); That when I call outputDocument.ToString() Outputs to this: <Document> <Stuff /> </Document> But I want it to look like this: ...

iTextSharp and VBnet question about headers

Hello! I'm wondering how can I put a header into my pdf file, cause i've tried the tutorials from here: http://itextsharp.sourceforge.net/tutorial/ch04.html And it have not worked. Ive done this: Dim head As New HeaderFooter(New Phrase("This is page: "), False) head.Border = Rectangle.NO_BORDER document.Header = head But VS2008 say...

Why only Seven elements in a Tuple in C# 4.0, with the eighth being another tuple?

In F# the syntax sugar hides the CLR implementation, why not in C# 4.0? ...

Entity Framework - Why does EF use LEFT OUTER JOIN's in a 1-to-1 relationship?

Why does .NET Entity Framework produce SQL that uses a subquery and left outer join on a simple 1-to-1 relationship? I expected to see a simple join on the two tables. I'm using Devart Dotconnect for Oracle. Any ideas? Below is the output I see courtesy of the EFTracingProvider: SELECT 1 AS C1, "Join1".USER_ID1 AS USER_ID, ... FROM "M...

Read pdf contents using webbrowser control in C#

I need to render pdf file to a webbrowser control like how ie render it. question is, i need to get the content of the pdf file from the webbrowser control. how can i do it? help please. Jepe ...

What does my project need to reference in order to use the Windows shell?

Specifically, I want to use IShellFolder, IExtractImage and ShellInterop in order to extract thumbnails from PDF and DOC files. Also, the namespace I need to import would be handy too Thanks so much for taking a look at this newbie question :) Iain ...

.NET Framework generates strange DCOM error

Hello, I am creating a simple application that enables merging of key-value pairs fields in a Word and/or Excel document. Until this day, the application has worked out just fine. I am using the latest version of .NET Framework 4.0 (since it provides a nice wrapper API for Interop). My sample merging method looks like this: public by...

Executing F# scripts

I'm trying to practice my F# by writing small console scripts in F# in place of my usual method of writing shell scripts/batch files. I currently run them using "fsi script.fsx [args]". Is there a way I can associate these fsx files with fsi so that I can run them directly like "script.fsx [args]"? ...

Get Computer Name in C# without referencing Microsoft.VisualBasic.dll

Is there any way, other than referencing the Microsoft.VisualBasic.dll (such as as below in .NET 3) to retrieve to Computer Name new Microsoft.VisualBasic.Devices.ServerComputer().Name ...

SHA512 within Silverlight is not available, is there a managed library available?

SHA512Managed is missing in Silverlight (for Windows Phone 7 CTP SDK), only upto SHA256 is available for use. Does anyone know a .NET class that I could use that offers a self-contained C# or VB.net SHA512 implementation? I need to use this for authentication to a HTTP web service. Thank you ...

In .NET, what thread will Events be handled in?

I have attempted to implement a producer/consumer pattern in c#. I have a consumer thread that monitors a shared queue, and a producer thread that places items onto the shared queue. The producer thread is subscribed to receive data...that is, it has an event handler, and just sits around and waits for an OnData event to fire (the data...

Can I use a stream to INSERT or UPDATE a row in SQL Server (C#)?

Suppose I have a VarBinary[MAX] column, can I insert or update into that column using a type derived from System.IO.Stream? How? I think that I can obtain a read-only stream from such a column using a SqlDataReader, calling GetSqlBytes() on the reader, getting the SqlBytes instance, and then referencing the Stream property on that. ...

Serialized NHibernate Configuration objects - detect out of date or rebuild on demand?

I've been using serialized nhibernate configuration objects (also discussed here and here) to speed up my application startup from about 8s to 1s. I also use fluent-nhibernate, so the path is more like ClassMap class definitions in code fluentconfiguration xml nhibernate configuration configuration serialized to disk. The problem f...

AppDomain Creation In .Net

Is there a way we can clone Current Application Domain & its Assembly in to new created domain to execute same piece of code in multiple domain having same dependencies as current domain have. ...

How do I add a method to the Form class in Windows Forms?

I want to add a new method in Windows.Forms.Form class.. Please help how to do this if anyone knows.. ...

What is application and process?

An application consists of one or more processes. A process, in the simplest terms, is an executing program. One or more threads run in the context of the process. A thread is the basic unit to which the operating system allocates processor time. A thread can execute any part of the process code, including parts currently being executed ...

ASP.NET - Take a screen capture of a particular area of the screen?

Is it possible to take a screen capture of a particular area of a web-page from the web-page's own ASP.NET code? I need to display 6 images that are stacked on top of one another using CSS, and I'd like to offer the user the ability to right-click save-as if possible by stacking the screen capture on top top of the original image stack....