ado.net

Why is TransactionScope using a distributed transaction when I am only using LinqToSql and Ado.Net

We are having problems on one machine, with the error message: "MSDTC on server XXX is unavailable." The code is using a TransactionScope to wrap some LingToSql database code; there is also some raw Ado.net inside of the transaction. As only a single sql database (2005) is being accessed, why is a distributed transaction being ...

Can the SqlDataAdapter refresh itself when the table is changed from an outside source?

My SQL Server table is updated from outside of my program (from a SQL trigger, actually), so the DataSet doesn't realize that there are changes and my DataGrid doesn't update unless I explicitly call SqlDataAdapter.Fill() again (e.g. with a "Refresh" button or a timed event). Is there a way that ADO.NET can subscribe to change events or...

Check if stored proc exists in ADO.Net?

How do I check that a stored procedure exists using ADO.Net? Is there a specific way to do this (apart from executing SELECT OBJECT_ID() and checking the result)? ...

Is Entity Framework worth moving to for a new small app?

Hi Is Entity Framework worth moving to for a new small app? About 10 tables and a WinForms app. ie the alternative being DataTables/DataRows or Linq-to-SQL ...

How to get Top 5 records in SqLite ?

I have tried this which did not work. select top 5 * from [Table_Name] ...

ADO.NET parameters from TextBox

I'm trying to call a parameterized stored procedure from SQL Server 2005 in my C# Winforms app. I add the parameters from TextBoxeslike so (there are 88 of them): cmd.Parameters.Add("@CustomerName", SqlDbType.VarChar, 100).Value = CustomerName.Text; I get the following exception: "System.InvalidCastException: Failed to convert parame...

Specification of Extended Properties in OleDb connection string?

At the moment I'm searching for properties for a connection string, which can be used to connect to an Excel file in readonly mode. Searching Google gets me a lot of examples of connection strings, but I can't seem to find a specification of all possibilities in the 'Extended Properties' section of the OleDb connection string. At the mo...

ORM/ADO.NET data services for asp.net-mvc web application..

As i am a beginner to asp.net-mvc which should i use ORM/ADO.NET data services.... As far as i see all the examples are only with ORM support.... So experts please guide me on this... ...

.NET - Is there a way to programmatically fill all tables in a strongly-typed dataset?

Hello, all! I have a SQL Server database for which I have created a strongly-typed DataSet (using the DataSet Designer in Visual Studio 2008), so all the adapters and select commands and whatnot were created for me by the wizard. It's a small database with largely static data, so I would like to pull the contents of this DB in its en...

How to print all columns in a datareader

Using c# how do I print all columns in a datareader. ...

Custom Logic and Proxy Classes in ADO.NET Data Services

I've just read "Injecting Custom Logic in ADO.NET Data Services" and my next question is, How do you get your [WebGet] method to show up in the client-side proxy classes? Sure, I can call this directly (RESTfully) with, say, WebClient but I thought the strong typing features in ADO.NET Data Services would "hide" this from me auto-magical...

Do I really need an ORM?

We're about to begin development on a mid-size ASP.Net MVC 2 web site. For a typical page, we grab data and throw it up on the web page, i.e. there is not much pre-processing of the data before it is sent to the UI. We're now making the decision whether or not to use an ORM and if yes, which one. We had been looking at EF2 AKA EF4 (...

Is there a way to parametrize ORACLE 10g SELECT-query with IN-clause

I saw couple of SO questions (SO) concerning SQL-server. For SQL-server there was no decent solution. All were hacks/workarounds. What about Oracle? Is it same answer (Paremeterizing each value)? Any Oracle example without LINQ would be appreciated (I have .NET 2.0). Thanks & BR -Matti ...

LinkDemand error on webserver when using TraceSource

Hi, On a webserver (shared hosting provider) I published a website with a ADO.Net Framework model in use with MySql Connector 6.3.1. When I request a page, a Security Exception will be happen with this error messages: "LinkDemand The type of the first permission that failed was: System.Security.Permissions.SecurityPermission The Zone o...

Can a stateless WCF service benefit from built-in database connection pooling?

I understand that a typical .NET application that accesses a(n SQL Server) database doesn't have to do anything in particular in order to benefit from the connection pooling. Even if an application repeatedly opens and closes database connections, they do get pooled by the framework (assuming that things such as credentials do not change...

Retrieve entities with children per one sql call. ADO.NET Entity framework

Hello everybody, I have two tables: A & B B { B1: Field1, B2: Field2, ... } A { Children: List of B, A1: Field1, A2: Field2, } I want to retrieve "A" entities with related "B" entities like this: DataContext.A.Select( a => new MySubset( A1 = a.A1, Children = a.Children.Select(b => b.B1).ToList())...

Entity Frame - how do I avoid this "Only key members can be mapped as part of the EndProperty mapping"?

Hi, QUESTION: How do I work around Entity Framework error I'm getting "Only key members can be mapped as part of the EndProperty mapping". I'm running VS2010 with C# project and Sqlite. Background: I imported two tables into the EF designer Webfiles and Relationships I created an Associations between them As Webfile.ID maps to Relat...

How to get original DataColumn value from DataRow ?

I have a DataTable and i want to figure out the Original column value for all the modified data rows. I am using following approach to get the Orginal column value before the DataRow was modified DataRow[] dataRowArray = dataTableInstance.Select(null,null,DataViewRowState.OriginalRows); DataRow originalDataRow = dataRowArray[rowIndex]...

C# Winforms ADO.NET - DataGridView INSERT starting with null data

I have a C# Winforms app that is connecting to a SQL Server 2005 database. The form I am currently working on allows a user to enter a large amount of different types of data into various textboxes, comboboxes, and a DataGridView to insert into the database. It all represents one particular type of machine, and the data is spread out ove...

ADO.NET: Faster way to check if the database server is accessible?

At the moment I am using this code to check if the database is accessible: public bool IsDatabaseOnline(string con) { bool isConnected = false; SQLConnection connect = null; try { connect = new SQLConnection(con); connect.Open(); isConnected = true; } catch (Exception e) { isConnected = ...