Tag: .net

Datetime values incorrect within stored procedure, related to .NET membership user validation

I’m having a strange problem with SQL Server 2008, in which some datetime variables within stored procedures are getting incorrect values (1754-01-01). Here is the background/context of the situation: I’m working on an ASP.NET web application using the SqlMembershipProvider class. I use the out-of-box functionality for storing user data in the database, validating usernames/passwords, etc. […]

Search full name with single input box

Let’s say I have a table that contains the following fields: UserId | FirstName | LastName I’d like to put together a search form with a single input for finding people by name. I’ve seen quite a few questions that touch upon this, but am looking for some guidance from someone that has implemented this […]

Possible reasons for error: “The cast to value type 'Decimal' failed because the materialized value is null”

I’m getting a report of errors from a production system. I don’t have easy access to the production system. I will get all the data that I need for it in due course, but what I’m trying to do is expedite the process of resolution of this issue. I’m trying to eliminate as much guesswork […]

Determining current owner of SQL Server instance is by interrogating Failover Cluster Management Service using C#

How can I determine who the current owner of SQL Server instance is by interrogating Failover Cluster Management Service using C#? This is on SQL Server 2008. I have the fail over cluster management service configured and I need a programmatic way to determine the current owner.

Without installing SQL Server, .net application which inserts data can run on the machine?

Is there any way that without installing SQL Server on a machine, a .NET application which inserts and updates data can run on the machine?

C# sql query to add attributes for the elements in xml

I want to display the XML file by taking tag from the XML_TAGS table, and attributes from theMAPPED_TAGS_ATTRIBUTES table – something like <element attributes></element>: String sql = “SELECT Dtd_Tag,Dtd_Attribute_Name FROM Xml_Tags, Mapped_Tags_Attributes WHERE Mapped_Tags_Attributes.Pdf_Tag = Xml_Tags.Pdf_Tag ORDER BY Mapped_Tags_Attributes.Pdf_Tag FOR XML AUTO”;

Is there an automated way to update an entity model with the Entity Framework?

It seems at this point all one can do is manually update it from within Visual Studio, recompile the assembly then deploy. Is that the only way? Or is there an easier, automated method of doing so?

Uploading a csv file to sql server – Identity problem

Given a column structure in a CSV file of: First_Name, Last_Name, Date_Of_Birth And a SQL Server table with a structure of ID(PK) | First_Name | Last_Name | Date_Of_Birth (Field ID is an Identity with an auto-increment of 1) How do i arrange it so that SQL Server does not attempt to insert the First_Name column […]

What happens if network is lost while rolling back transaction with TransactionScope in .Net

I have this following code:- using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required)) { bool IsCreated=false; context.CommandTimeout = 120; if(IsCreated) transactionScope.Complete(); } Now If transactionScope.Complete() is not called, Transaction is rolled back once scope of using is Complete. However IF before this there is a network outage, how will this transaction be rolled back. It is rolled […]

Is there any way to show records that are preventing a delete due to referencial integrity?

i have a generic problem all over my application and want to see if there is a common generic way of solving it. The main issue is how to let users know which records are linked when you try to delete a record from a joined table. for example, let’s say i have two database […]

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