ado.net

ADO.NET: How to get Return Value of a Stored Procedure

Probably an easy-to-answer question. I have this procedure: CREATE PROCEDURE [dbo].[AccountExists] @UserName nvarchar(16) AS IF EXISTS (SELECT Id FROM Account WHERE UserName=@UserName) SELECT 1 ELSE SELECT 0 When I have ADO.NET code that calls this procedure and does this: return Convert.ToBoolean(sproc.ExecuteScalar()); Either...

connection string to a SQL Server cluster

Hello everyone, Could anyone point me or tell me how to write connection string to a SQL Server cluster instance? I want to establish trusted connection to a database (initial catalog) of the specific instance of SQL Server cluster. I find for quite some time but can not find official answer from Google. BTW: I am asking for the connec...

ADO.NET Entity Framework, Northwind, and Employee.Orders > 0

So I'm trying to work on a sample app. Trying to dig into ADO.NET Entity Framework. I get an employee back using a method with LINQ like this: public IList<Employee> FindByLastName(string lastName) { IList<Employee> emps; var e = from emp in _ctx.Employees where emp.LastName == lastName select emp; em...

Ado.Net Entity : Objects get autoadded to database...

I have the following problem: I have a transactions database that contains transactions. When inserting new transactions I need to check if they already exist. I then have a list of transactions that are new, and those need to be added to the database. in code: List<Transaction> allNewTransactions = Parse(rawDataInput); #count = 100 ...

SQL Server 2005 Insert parent/child xml data

Given an xml document that looks like this here: <parentRecords> <parentRecord field1="foo" field2="bar"> <childRecord field1="test" field2="text" /> <childRecord field1="test2" field2="text2" /> </parentRecord> <parentRecord field1="foo2" field2="bar2"> <childRecord field1="test3" field2="text3" /> ...

Ado.net data services

What is Ado.net data services. Where can i download latest version anf how to use in my asp.net ajax application? ...

How to delete many-to-many relationship in Entity Framework without loading all of the data

Does anyone know how to delete many-to-many relationship in ADO.NET Entity Framework without having to load all of the data? In my case I have an entity Topic that has a property Subscriptions and I need to remove a single subscription. The code myTopic.Subscriptions.Remove(...) works but I need to load all subscriptions first (e.g. myTo...

GridView doesn't report an exception

Hello, If I bind GridView to SqlDataSource and also set AutoGenerateEditButton to true, and if I then try to update a field ( this field being a primary key in database ), then database should return an error and thus SqlException should be thrown?! So why doesn’t page report an exception? Instead, all Gridview does is setting all fi...

Entity Framework Generated SQL for Entity Mapped to a View

I've mapped an EDM entity to a database(SQL Server 2005) View. The entity is a simple Movie Entity which has properties of ID, Name and DateInserted which corresponds to a View which has the following definition: SELECT iMovieID, vchName, dtInsertDate FROM dbo.t_Movie WITH (NOLOCK) The table t_Movie has the following definition...

Introduction to database interaction with C#

Up to now in my programming career (two years) I have not had much database experience, but the company where I now work uses databases extensively for their product, and I feel behind the curve. So I would like to know how best to start learning database interaction with C#. I've read about LINQ-to-SQL and ADO.net. Are these the right ...

Access to SQL Server messages via ADO.NET

Is it possible to access the SQL Server "by-product messages" via ADO.NET? Due to the lack of words, by "by-product messages" I mean the output which appears in the Messages tab in Microsoft SQL Server Management Studio. What I particularly have it mind is to read the output of SET STATISTICS TIME ON. It appears that SqlDataReader does n...

ADO.Entities fulltext support

I was using Linq to SQL and it didn't have any FULL-TEXT support. I went back to Stored procedure. The second reson was because stored procedure is almost 3 times slower. I would like to know if the performance is better for ADO.Entities and if has support for fulltext search ...

Transaction count after EXECUTE error

I have a stored procedure that looks something like: CREATE PROCEDURE my_procedure @val_1 INT, @val_2 INT AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRY BEGIN TRANSACTION; INSERT INTO table_1(col_1, col_2) VALUES (@val_1, @val_2); COMMIT TRANSACTION; END TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION; ...

ADO.NET, Closing an OracleConnection without prior Commit or Rollback: Will it leak?

Suppose I am doing the following: using (OracleConnection conn = new OracleConnection(connStr)) { OracleTransaction trans = conn.BeginTransaction(); OracleCommand command = new OracleCommand(cmdTxt, conn, trans); // this statement is executed in a transaction context: command.ExecuteNonQuery(); } // the using statement w...

Shared values in column between datatables in ado.net

I'm using c# and i have three datatables, all three have an int column named idnum, what i need is to keep all numbers in the column idnum unique in the three tables and the next number will always be the small available. For example: table a idnum=1 idnum=3 idnum=4 table b idnum=2 idnum=7 table c idnum=8 in this case the n...

Paging Support - ADO.NET Entitry Framework and LINQ

What kind of paging support is offered through ADO.NET EF and LINQ? What does a "first 10" Select look-like? A "next 10" Select? ...

How do I write this code using SubSonic?

I have some legacy code that I'm rewriting using SubSonic to help the future maintainers. For the most part it's been relatively simple, as everything makes a stored procedure call. But now I'm having some difficulty with some tightly-coupled ADO.NET code. The code depends on the SqlDataAdapter to decide when to call an INSERT or UPDATE...

How to implement Development and ProductionDatabase in ASP.NET MVC with Ado.NET Entity?

I have used Ruby on Rails with ActiveRecord, so I am quite used to switching to Production/Development database. I am wondering, how do people implement Development and Production Database difference in ASP.NET MVC (preferably with ado.net entity). I tried to have it by creating 2 entity datasets with the same name in a different nam...

What is the recommended batch size for SqlBulkCopy?

What is the recommended batch size for SqlBulkCopy? I'm looking for a general formula I can use as a starting point for performance tuning. ...

Cannot add Entity Data Model in Visual Studio

I am running Visual Studio 08 Team Edition with .NET Framwork 3.5 SP1 on WinXP. I am trying to add a Entity Data Model to my project, however, the option to add an "ADO.NET Entity Data Model" selection does not appear. To give you a visual, I am essentially following the directions here ( http://www.aspfree.com/c/a/ASP.NET/Introduction...