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...
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...
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...
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
...
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" />
...
What is Ado.net data services. Where can i download latest version anf how to use in my asp.net ajax application?
...
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...
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...
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...
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 ...
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...
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
...
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;
...
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...
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...
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?
...
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...
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? I'm looking for a general formula I can use as a starting point for performance tuning.
...
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...