Skip to main content

Posts

Showing posts from May, 2010

Convert Visual Studio 2010 Project to Visual Studio 2008

I recently installed Visual Studio 2010.when I’m going to open a project which was developed from VS 2010 in VS 2008 I was getting an error. So I thought of finding a way to solve my problem. Here is the solution 1. Open the .sln file corresponding to the Project to be converted with Notepad 2. Locate the following line: Microsoft Visual Studio Solution File, Format Version 11.00 Replace 11.00 with 10.00 3. Locate the following line: # Visual Studio 10 Replace 2010 with 2008 Save the File 4. Delete the .cache files existing in the following paths: obj/debug obj/release 5. Open the project with Visual Studio 2008 6. Build the project with Visual Studio 2008

Retrieve SQL Table Column data into a Array

When I was searching how to “Retrieve SQL Table Column data into an Array”, I found many ways to do that. But I was not happy about those solutions. So I searched for it so many times. Finally today I found a way to do that easily. So I thought to share with you all.   public static string [] Genre() { string Query = "SELECT <Column Name> FROM <Table Name>"; SqlConnection ConnObj = new SqlConnection(Connection()); ConnObj.Open(); SqlCommand CommObj = new SqlCommand (Query, ConnObj); SqlDataReader Reader = CommObj.ExecuteReader(); string [] TempArray = new string [200]; int Name = Reader.GetOrdinal( "Name" ); //Gets the column ordinal, given the name of the column. int i = 0; while (Reader.Read()) { TempArray[i] = Reader.GetString(Name); i++; } Reader.Close(); return TempArray; } This function will return an array of the values.You can use it anyway you want….