Tag: c#

How to Store a User-defined Class Object in Sql Server 2008 using C#?

Possible Duplicate: Save byte[] into a SQL Server database from C# I have a class named LeaveDetails.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace LeaveMgmt_14dec { [Serializable] public class LeaveDetails { public string date; public string leave_type; } } Then a created a List of Objects of LeaveDetails Class. List<LeaveDetails> Details = new […]

Convert TextBox value to DateTime SQL Server

I made a date picker from the calendar control in ASP.net using C#. The date format in the TextBox is 08/01/2012. When I try to do an insert I get this error: Message: Input string was not in a correct format. here is my code: cmd.Parameters.Add(“@date”, SqlDbType.DateTime).Value = Convert.ToDateTime(txtDateins.Text); How do I get that fixed […]

how to merge two select queries?

I solved that query… but now I have to merge these two queries: (SELECT Zila, COUNT(AbhidayMaster.OfficeRegId) As AbhidayPaidSansthan, SUM(AbhidayMaster.TotalEmp) As TotalWorkerPaid FROM PanjikaranMaster, AbhidayMaster WHERE PanjikaranMaster.OfficeRegId=AbhidayMaster.OfficeRegId AND AbhidayMaster.DipositDate Between (‘2012-06-22’) AND (‘2012-09-19’) GROUP BY Zila) Select ((SELECT count(distinct OfficeRegId) FROM PanjikaranMaster) – (SELECT count(distinct OfficeRegId) FROM AbhidayMaster)) As AbhidayNotPaidSansthan

Data integrity in Entity Framework

Are there any consensus as to what is considered the best method in always maintaining data integrity in Entity Framework. i.e. when adding or deleting entities, how do I make sure the loaded model is the most recent, and that nothing has changed on the db behind my back? A rough method that seem to […]

Where to migrate data from SQL Server?

I’m working on an application which was previously developed with EF, SQL Server, C# and WinForms. For some reasons we need to remove SQL Server and use some and put data in some other container like XML, Excel sheet or in memory classes. DAL was designed using EF with repository and UOW pattern. Can you […]

Loading multiple large ADO.NET DataTables/DataReaders – Performance improvements

I need to load multiple sql statements from SQL Server into DataTables. Most of the statements return some 10.000 to 100.000 records and each take up to a few seconds to load. My guess is that this is simply due to the amount of data that needs to be shoved around. The statements themselves don’t […]

Locking the record and unlocking

I am new to this web application development and I have task to do. This probably would be some kind of a service (probably WCF at least this is my idea) which will be responsible for locking and unlocking records in db. I’m searching for some kind of best practices and/or tools which wil do […]

Set write permission on folder create

Hi I have been trying to properly configure IIS 6 to give write permisiosn for about 2 days now and I can’t seem to find any good resource on this.I am a bit new to ASP.NET and until now I never had to work with IIS. What I am trying to do is upload a […]


I have a SQL Server with a roster/information. I would like to update the table with situps, pushups, and Id. I know how to insert information into a table, but having trouble with the Update part of it. Here is my code: SqlConnection conns = new SqlConnection(ConfigurationManager.ConnectionStrings[“TestDBConnectionString1”].ConnectionString); SqlCommand cmd = new SqlCommand(“UPDATE test SET SitUps […]

How to transfer application role with password?

I need to make a some sort of template from existing database (MS SQL 2012). Template must have identical schema (tables, indexes, roles, etc), but it must not have data from source DB. To achieve this, I’m using Transfer class from SMO. My current transfer settings are: transfer.CopyAllObjects = true; transfer.CopyAllSynonyms = true; transfer.CopyData = […]

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