How to select last 5 or 10 or … rows in a SQL Server data table ? Solution 1: This is the normal solution SELECT TOP N * FROM MyTable ORDER BY Id DESC Solution 2:  Solution 1 is the normal way but when the data table is huge but the Id is not indexed, [Read More ...]

There are lots of ways to update a table data, here we have one example as the following: UPDATE HOSTDB SET InScan = NOWHOSTDB.InScan, Alarm1 = NOWHOSTDB.Alarm1, Alarm2 = NOWHOSTDB.Alarm2, Alarm3 = NOWHOSTDB.Alarm3, Alarm4 = NOWHOSTDB.Alarm4 FROM HOSTDB, NOWHOSTDB WHERE HOSTDB.idx = NOWHOSTDB.HOSTDBidx AND HOSTDB.idx = 1640

Most of .net developers develop Windows applications using SQL Server database, but how about some cases that use MySQL? Microsoft has announced that they no more provider API or connector or related library to connect the 3rd party database such as Oracle, MySQL, the reason is that most of 3rd party companies have already provided [Read More ...]

We have a small MVC project, once a time we got the following error message in a popup window: …. Unable to find the requested .Net Framework Data Provider. It may not be installed. The reasons are very depends, there are lots of different reasons on the internet. Our case looks some special: The reason [Read More ...]

Microsoft SQL Server Compact 4.0 is a free, embedded database that software developers can use for building ASP.NET websites and Windows desktop applications. SQL Server Compact 4.0 has a small footprint and supports private deployment of its binaries within the application folder, easy application development in Visual Studio and WebMatrix, and seamless migration of schema [Read More ...]

How to update LINQ to SQL Class after you changed your data tables? It might be a headache problem if you always use LINQ to SQL. Because LINQ to SQL is a disconnect architecture, so the normal way is doing update operation in LINQ to SQL Design window by manual: 1: Delete the modified tables [Read More ...]

ADO.NET can work on either connected mode or disconnected mode. Connected mode implies the database connection is open, for example, if you use DataReader, the database connection state keeps on open; If you use DataSet or DataAdapter, the database connection status is cloesed, it is ADO.NET disconnected mode; When DataAdapter Fill() data to DataSet, the [Read More ...]

DataSet is an in-memory representation of a database, providing a consistent relational programming model no matter what format of data source. It contains multiple data tables and their relationship and constraints information. DataSet works on ADO.NET disconnected mode; DataReader is a read only, forward only stream of data from a database,  Data are returned as [Read More ...]

There is a table structure here: CREATE TABLE [dbo].[FEEDBACK_LOG]( [Idx] [int] IDENTITY(1,1) NOT NULL, [FBIdx] [bigint] NOT NULL, [EventStatus] [int] NULL, [StartTime] [datetime] NOT NULL, [EndTime] [datetime] NOT NULL, [Length] [int] NOT NULL, CONSTRAINT [PK_FEEDBACK_LOG] PRIMARY KEY CLUSTERED ( [Idx] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS [Read More ...]

We have already had a post about “Clear ID counter after delete data table” which is just for reset identity column in SQL Server using Truncate command. However, Truncate is just the one method of resetting Identity in SQL Server, and it is only for the table which no foreign keys defined. If you use [Read More ...]

© 2012 CodeEase.com Suffusion theme by Sayontan Sinha