Tag: .net

Is it possible to read the previous state of a row in a transaction?

I have .NET code that creates a transaction and in this transaction, it performs an insert/update followed by validation. If validation fails, an exception is thrown to rollback changes. I need add an validation rule to this VB.NET code that require checking the current state and the previous state of a row (ie: the state […]

Entity Framework Cannot Open Database Requested By the Login – The Login Failed For User

I’ve just uploaded my website to a server and getting an error called “cannot open database requested by the login the login failed login failed for user”. In my global.asax file on Application_Start method, I have this : Database.SetInitializer<MyContext>(null); So I created my database manually and after used script to create tables. But when I […]

Expects parameter '@CustomerPhoto', which was not supplied

I have this error during update of the customer table: Procedure or function ‘Update_Customer’ expects parameter ‘@CustomerPhoto’, which was not supplied. Stored procedure code : ALTER procedure [dbo].[Update_Customer] @CustomerID int output, @CustomerName nvarchar (50), @CustomerPhoto image, @CustomerEmail nvarchar(Max), @CustomerPhone1 nvarchar(12), @CustomerPhone2 nvarchar(12), @CustomerAddress nvarchar(Max), @CustomerFax nvarchar(12), @CustomerStatus bit, @CountryID int, @CityID int, @Notes nvarchar (Max), […]

ssis package default Project variables

I have a dtsx package and I am looking at the xml in notepad++. Here is the part that I have a question about: <SQLTask:ParameterBinding SQLTask:ParameterName=”@ExecutionId” SQLTask:DtsVariableName=”User::ExecutionId” SQLTask:ParameterDirection=”Input” SQLTask:DataType=”11″ SQLTask:ParameterSize=”-1″ /> <SQLTask:ParameterBinding SQLTask:ParameterName=”@LogPackage” SQLTask:DtsVariableName=”System::PackageName” SQLTask:ParameterDirection=”Input” SQLTask:DataType=”16″ SQLTask:ParameterSize=”50″ /> <SQLTask:ParameterBinding SQLTask:ParameterName=”@LogTask” SQLTask:DtsVariableName=”System::TaskName” SQLTask:ParameterDirection=”Input” SQLTask:DataType=”16″ SQLTask:ParameterSize=”50″ /> <SQLTask:ParameterBinding SQLTask:ParameterName=”@LogTypeId ” SQLTask:DtsVariableName=”$Project::BASE_LogTypeInfoId” SQLTask:ParameterDirection=”Input” SQLTask:DataType=”11″ SQLTask:ParameterSize=”-1″ /> I get […]

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 […]

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