Tag: .net

How to wait for a SQL Server database rollback to complete?

When using the ADO.NET SqlClient classes, there are a few ways in which a transaction can be rolled back. Either by explicitly calling SqlTransaction.Rollback, or having a command timeout, or a transaction timeout within a transaction scope etc. But how can I detect when this rollback has completed when using SQL Server (2012 or later)? […]

SQL Server PolyTab.GeometryCol.STContains(PointTab.GeometryCol) = 1 not Allowed

I have two basic tables with geometry column types in them. One has polygons and the other points, and I am trying to join them using the following basic query: Select dbo.PointTab.*, dbo.PolyTab.Name from dbo.PointTab Inner Join dbo.PolyTab On dbo.PolyTab.GeometryCol.STContains(dbo.PointTab.GeometryCol) = 1 I have tried a great many variations on this query, but always get […]

Is it possible to run multiple SQL statements in parallel within the same transaction from .net?

I want to upsert to 7 tables in SQL Server. I first SqlBulkCopy into 7 staging tables and then I merge them to the real tables. I need it to be faster, so I’m wondering if there is a way to run these in parallel but within the same transaction, because if anything fails I […]

Synchronization of SQL Server db tables based on a condition

I have a following scenario: multiple windows client apps (C#, occasionaly offline app) with SQL Server express, and a central web app (ASP.NET) with SQL Server standard. I need to sync clients db with central db, however some client tables need to be bi-directionaly synced completely with server, but some tables from client need to […]

.net load latest version of assembly

I have a .net application that references the Microsoft.SqlServer.Smo assembly. The assembly is not distributed with the application. Instead the sql sdk is installed in the system and the dll is registered in the GAC so that the application can load. There is no problem with this except that on some target machines I have […]

VPN Access to SQL Server from Web Server

I am setting up a .Net based application on an Internet server and in the same hosting provider data center I am setting up SQL Server. My desire is to have SQL Server protected through VPN such that only application server can access it. In addition, I should be able to access the database server […]

The type '<>f__AnonymousType2`2' must declare a default (parameterless) constructor

I’m wondering if anyone here has an idea of why I’m getting the exception System.InvalidOperationException: The type ‘<>f__AnonymousType2`2[System.String,System.Int32]’ must declare a default (parameterless) constructor in order to be constructed during mapping. thrown from my LINQ-to-SQL query var query = ( from change in context.ProductChangeTrackings from expression in context.ProductDataQualityRuleExpressions join rule in context.ProductDataQualityRules on expression.ProductDataQualityRuleID equals […]

How do I avoid “sleeping” processes in MSSQL?

Currently I’m experiencing alot of issues with Server Processes (Seen from sp_who2) that is “sleeping” instead of just, finishing (being removed), when I connection to my MSSQL Database, calls a Stored Procedure, get some data and then closing the connection. What’s the best way in C#/.NET to connect to a MSSQL database, call a Stored […]

Can't login with session

I’m trying to login with session but there’s something wrong. Its can’t get values from the database to login. Please check the code and help me out. Whenever I execute the code it won’t go into the if. Database name is Session and table name is login. protected void Button1_Click(object sender, EventArgs e) { SqlConnection […]

SSIS script tasks can't compile because of missing dlls

We rolled out SSIS-Packages to our customers, that include script tasks, which reference 5 dll files in the folder: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework \v4.0 On the target server, there doesnt seem to bee .dll files in this folder, only xml files. Therefore the script tasks can not compile. Would it suffice to add these missing […]

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