Only servers up to Microsoft SQL 2005 are supported

only servers up to 2005 are supported
When trying to connect a new Database Connection to the Visual Studio 2008 or higher, a support problem comes up stating that only servers up to 2005 are supported.

This can easily be solved by installing the Visual Studio Service Pack 1 available from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13276 ready in iso format.

Convert DateTime to String in Stored Procedure

Stored Procedure convert date to string

In some cases, it is very hard or complicated to display the time as a string. For instance, when using repeaters, binding is done through the eval so data cannot be manipulated. For this reason it is quite easy to manipulate the time in the stored procedure and return it as a string. Below is an example of the code required to convert date to string:

CREATE PROCEDURE sp_sampleConvertDateToString

AS

SELECT Column1, Column2, CONVERT(nvarchar(100), Column3, 106) AS Column3String

FROM DummyTable

RETURN

it is also possible to return the current date instead of a column from the table, which would looks like:

CREATE PROCEDURE sp_sampleConvertDateToString

AS

SELECT *, CONVERT(nvarchar(100), GetDate(), 106) AS DateNow

FROM DummyTable

RETURN

There are various ways to display the date as string, below is a list of the mostly used options available to display the date and time.

 Date as String  Parameter  Stored Procedure Code
01/01/11  1  SELECT CONVERT(nvarchar(100), getDate(), 1)
01 Jan 11  6  SELECT CONVERT(nvarchar(100), getDate(), 6)
Jan 01, 11  7  SELECT CONVERT(nvarchar(100), getDate(), 7)
Jan 01 2011 0:00PM  100  SELECT CONVERT(nvarchar(100), getDate(), 100)
01 Jan 2011  106  SELECT CONVERT(nvarchar(100), getDate(), 106)
01/01/2011 0:00:00 PM  22  SELECT CONVERT(nvarchar(100), getDate(), 22)

ADO.NET Execute Commands .. When to use what ??

SqlDataAdapters for SqlCommand

A database on a server (example: MySql, msSql, etc) is all accessed by ADO.NET using SqlConnection objects. There are typically four tasks we can perform using SQL which are, selecting queries from database, insert, update and delete. Each having different ADO.NET SqlCommand objects to query the different statements. SqlCommands are mainly divided in two categories, SqlDataAdaptors (disconnected) and SqlDataReaders (Connected). The mostly used SqlDataAdaptors are the: Fill() command, ExecuteScalar(), and ExecuteNonQuery().  For each, an example will be displayed below along with some explanation.

Continue reading

LinQ to SQL simple Insert Update and Delete

Since I was given a task to implement new technologies, I came about selecting LinQ. It was quite hard to find a simple place or tutorial where I could find how to do simple queries without complexities. Therefore I decided to post a blog to describe as simple as can be the process of inserting updating and deleting from LinQ to SQL.

Continue reading