ado.net

Retrieving the value of RETURN @@IDENTITY in C#

Here's a very simple question. I have an SP that inserts a row into a table and at the end there's the statement RETURN @@IDENTITY. What I can't seem to find is a way to retrieve this value in C#. I'm using the Enterprise library and using the method: db.ExecuteNonQuery(cmd); I've tried cmd.Parameters[0].Value to get the value but tha...

Should I persist a sqlconnection in my data access layer?

It seems like there is a lot of overhead involved in rapidly opening and closing sqlconnections. Should I persist a connection (one, per client, per database), or continue declaring a new sqlconnection object whenever I need one, and making sure I clean up after myself? What have you done? What worked well and what worked poorly? ...

Output Parameter not Returned from Stored Proc.

I am calling a SQL proc that has 3 OUTPUT params. After the call to the proc one of the params does not return a value when the other two do. Profiler shows that all 3 values are being returned. The params are declared as follows in the proc... @UsrVariableID INT OUTPUT, @OrganisationName NVARCHAR(256) OUTPUT, @Visible bit OUTPUT and...

Can ADO.NET Data Services use named pipes as a transport

I am well aware that the Rest based approach is targeting HTTP. I would love to use the REST APIs and other goodness between processes on the same computer. Since ADO.NET data services is built on top of WCF it would seem reasonable to assume that the transport in configurable to work with any of the WCF supported transports. Anyone k...

Define table names for results of multiple SQL selects in a single query

For example if I run the following query: select * from table1 select * from table2 And run it with a DB adapter (C#) I get a dataset with two tables. How can I define the names for the result tables in SQL? I can only do this inside the SQL. I don't have access to the c# code. ...

How to use Defining Query in SSDL in Entity Framework? Advantages and Examples will be helpful.

Hi, I need some info about using the Defining Query element within the SSDL of the Entity Framework. Advantages of using it and scenarios where it would be helpful would really help. An example and links will be great. Kind regards. ...

Set Return Type of Stored Procedure to Auto - Generated using Entity Framework.

Hi, In LINQ2SQL it was possible to set the return type of a stored procedure to auto generated. I am unable to do so with the Entity Framework. I want to set the return type of a stored procdure to auto-generated with the Entity Framework. Is this possible? Kind regards. ...

How should I get started learning about ADO.NET Entity Framework?

So here I am just about to start a big project using LINQ to SQL and then I read this: Is LINQ to SQL Truly Dead? by Jonathan Allen for InfoQ.com Well, I don't want to be supporting LINQ to SQL indefinitely if it's a dead end. So, how should I get started learning about ADO.NET Entity Framework? ...

How to get the generated SQL-Statment from a SqlCommand-Object?

Hi there. I have the following code: Using cmd As SqlCommand = Connection.CreateCommand cmd.CommandText = "UPDATE someTable SET Value = @Value" cmd.CommandText &= " WHERE Id = @Id" cmd.Parameters.AddWithValue("@Id", 1234) cmd.Parameters.AddWithValue("@Value", "myValue") cmd.ExecuteNonQuery End Using I wonder if there is any way t...

Join 2 datatables into one resultset

Hi, I have a dataset that contains 2 datatables they link together using a DataRelation. it it possible to selet from those tables into into one result set? thanks, Ofer ...

pass DataTable to unmanaged environment (visual c# 2005)

Hi, What will the best way to pass a datatable data to unmanaged environments? (c++) Ofer ...

ADO.NET Data Services Entity Framework request error when property setter is internal

I receive an error message when exposing an ADO.NET Data Service using an Entity Framework data model that contains an entity (called "Case") with an internal setter on a property. If I modify the setter to be public (using the entity designer), the data services works fine. I don’t need the entity "Case" exposed in the data service, so...

Connection pooling in asp.net

I´ve been looking for it yet in stackoverflow without success... Is it posible a connection pooling in asp.net? Is it worthwhile? How? ...

Scope of Oracle transactions when used from ADO.NET and involving triggers?

I am told by someone that when calling Oracle from ADO.net, when calling multiple inserts in a loop, where each insert causes a trigger to fire that includes within it's PL-Sql a Commit statement, that it is impossible to stop that commit from actually commiting the transaction. i.e., I want my ADO.Net code to begin a transaction before...

Can you bin-deploy ADO.NET Data Services?

Anyone know of a hack to deploy ADO.NET Data Services without .NET 3.5 SP1 (just 3.5) on the server? Mosso is not ready to roll out SP1. I think this would also require bin-deploying the Entity Framework. ...

ADO.NET record navigation

I've done development in both VB6 and VB.NET, and I've used ADODB objects in VB6 to handle recordset navigation (i.e. the MoveFirst, MoveNext, etc. methods), and I have used ADO.NET to handle queries in a row-by-row nature (i.e For Each Row In Table.Rows ...) But now I seem to have come to a dilemma. I am now building a program in VB.N...

Do you think it's advantageous to switch to Entity Framework?

With LINQ to SQL most likely going to not get as much active development as Entity Framework do you think it's best to switch to Entity Framework? I've personally found EF to be very clunky and hard to use compared to LINQ to SQL which feels very natural. EDIT: I recently posted an article on my blog about my feelings towards this pote...

Incorrect syntax near @[parameter name] when using parameterised Alter Database command

I'm trying to drop a SQL Server database using the following code: SqlCommand command = new SqlCommand("USE MASTER; ALTER DATABASE @database SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE @Database", connection); command.Parameters.AddWithValue("@database", TestingEnvironment.DatabaseName); command.ExecuteNonQuery(); When I ex...

ASP.NET-Saving Special Characters to Database

Please tell me how can save a string with special characters to DB.Special characters may contatin single quotes/double quotes etc.. I am using ASP.NET with C# ...

Does ADO.NET + massive INSERTs + Excel + C# = "A bad time"?

Basically I need to insert a bunch of data to an Excel file. Creating an OleDB connection appears to be the fastest way but I've seen to have run into memory issues. The memory used by the process seems to keep growing as I execute INSERT queries. I've narrowed them down to only happen when I output to the Excel file (the memory holds...