Tag: .net

SQL Exception on immediate reconnect

I have a winform app that uses LinqToSql as it’s DAL. There is a Central SQL DB and each laptop has a local SQLExpress DB. A seperate module, using Merge Replication, keeps the two in sync. When connection is lost to the central DB it ‘fails over’ to the local. This works great. However, when […]

Is it possible to retrieve the line number from an OleDbException caused by calling ExecuteNonQuery()?

We are calling ExecuteNonQuery on all files in a certain folder for version scripting and if there is a syntax error an exception is raised. I have been scanning MSDN for a way to get the line number but haven’t been able to find anything yet. There is a ‘SqlException’ class which does contain the […]

Sql server 2005 with ASP .NET encoding issue

I’m writing once again about my encoding issue… Now with some code samples. In a nutshell: when saving to database input data, some language specyfic characters like polish ‘ń’ won’t save – insted ‘n’ is saved. On the other hand, string: Adams æbler, with æ is saving. Here is code begind code that does save […]

Login failed for user ''. The user is not associated with a trusted SQL Server connection

My web service app on my Windows XP box is trying to log in to my sql server 2005 database on the same box. The machine is part of a domain. I am logged in in the domain and I am an admin on my machine. I am using Windows Authentication in my connection string […]

How to create a basic SQL Server job with SQL Server Express?

I need to monitor SQL Server jobs and for that I basically have to use sp_help_job. Anyway, the problem is that I don’t have any sql job running on my local machine so I can’t do any test. I need a simple method to create sql jobs just for this purpose (testing) but I only […]

which is faster for running SQL on small tabular data (250 records), XML or SQL server?

I’m working on a small standalone .NET app needs to refer to some tabular data and its only just selects and at most these tables have 250 records. Previously developers have used a SQL server database. Would i get a performance advantage if i simply convert the table data to XML and read from that? […]

Show same stored proc verbose output in a .NET that you would see in the Query Analyzer tool

The DBA displays a lot of info in his stored proc as it executes. From a Visual Studio 2003 CSharp Windows Form, when you launch a SQL Server 2000 stored procedure that returns records as well as an OUTPUT param, is it possible to display the same verbose output as you would see in the […]

Single Query returning me 4 tables, How to get all of them back into dataset?

How to fill multiple tables in a dataset. I m using a query that returns me four tables. At the frontend I am trying to fill all the four resultant table into dataset. Here is my Query. Query is not complete. But it is just a refrence for my Ques Select * from tblxyz compute […]

Can a Snapshot transaction fail and only partially commit in a TransactionScope?

Greetings I stumbled onto a problem today that seems sort of impossible to me, but its happening…I’m calling some database code in c# that looks something like this: using(var tran = MyDataLayer.Transaction()) { MyDataLayer.ExecSproc(new SprocTheFirst(arg1, arg2)); MyDataLayer.CallSomethingThatEventuallyDoesLinqToSql(arg1, argEtc); tran.Commit(); } I’ve simplified this a bit for posting, but whats going on is MyDataLayer.Transaction() makes a […]

Is this a recommended way to use a Stored Procedure with Entity Framework 4?

My code is doing two round trips to the database because I’m not sure if this is the correct way to create a collection of my POCO’s where the first round trip hits a stored procedure because of some specific SQL code. Scenario A user enters some AutoComplete search query into the UI. My code […]

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