Tag: ado.net

When I Insert Rows into a SQL Server 2005 Table will the order be preserved?

When I select a series of rows from a sql server 2005 table using an “order by” clause and then insert them into a different (and empty) sql server 2005 table can I count on the rows staying in the same order. The reason I am asking is that I want to manipulate the rows […]

How does ADO.Net know which version of the SQL Native Client to use if you have both SQL 2005 and 2008 in your environment?

How does ADO.Net know which version of the SQL Native Client to use if you have both SQL 2005 and 2008 in your environment?

See updates in a DataReader

Is there a way to see the updates done by other users in a table using a DataReader ? For example : in my DataReader, I am on the 10th row. Another user updates the 11th row. When I do myReader.Read(), I am seeing the old values. Is there a way to see the new […]

Is this UPDATE table statement correct in an msdn topic

I have seen this type of UPDATE statement (just like insert statement) in the following msdn topic: http://msdn.microsoft.com/en-us/library/aa0416cz.aspx#Y2461 UPDATE statement:- adapter.UpdateCommand = New SqlCommand(“UPDATE Customers ” & “(CustomerID, CompanyName) VALUES(@CustomerID, @CompanyName) ” & _ “WHERE CustomerID = @oldCustomerID AND CompanyName = ” & “@oldCompanyName”, connection) Is this statement correct or not? I have tried executing […]

I am receiving “PROMOTE TRANSACTION request failed because there is no local transaction active” in a System.Transaction.TransactionScope

I have an asp.net MVC app thats running for about a week then today started to get this error. Running on .net 4.0, Win 2K8 R2 talking to SQL Server 2K8 on Win 2K8 R2. All servers have MS DTC running on them. I am doing a simple aspnet membership create then creating additional data […]

Multiple Connection String

I am not sure if this is feasible in ADO.NET, but i still want to run by you gurus. I have a following sql query: select a.name, b.id from datasource1_table a, datasource2_table b where a.id=b.id 1) datasource1_table – SQL Server “SQLServer1” connection 2) datasource2_table – SQL Server “SQLServer2” connection So i have connection string that […]

Multi-layer design issues while using ADO.NET

In my multi-layer application, a data access layer reads the database and returns SqlDataReader for collections of objects and SqlDataRecord for a single object to a business layer. A business layer has constructors that initialize either a SqlDataReader or SqlDataRecord. That seemed a natural design to follow, however I run into multiple problems with readers […]

What SqlDbType maps to varChar(max)?

What SqlDbType maps to varChar(max)? SqlDbType.VarChar says that it is limited to 8K, though that may be a documentation error.

How do you deal with transport-level errors in SqlConnection?

Every now and then in a high volume .NET application, you might see this exception when you try to execute a query: System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. According to my research, this is something that “just happens” and not much can be done to prevent it. It […]

Is there anything faster than SqlDataReader in .NET?

I need to load one column of strings from table on SqlServer into Array in memory using C#. Is there a faster way than open SqlDataReader and loop through it. Table is large and time is critical. EDIT I am trying to build .dll and use it on server for some operations on database. But […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.