Skip to main content

Posts

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….

Create Table of Contents in MS Office 2007

You create a table of contents by choosing the heading styles — for example, Heading 1, Heading 2, and Heading 3 — that you want to include in the table of contents. Microsoft Office Word searches for headings that match the style that you chose, formats and indents the entry text according to the heading style, and then inserts the table of contents into the document. Microsoft Office Word 2007 provides a gallery of automatic table of contents styles. Mark the table of contents entries, and then click the table of contents style that you want from the gallery of options. Office Word 2007 automatically creates the table of contents from the headings that you marked.   Mark entries for a table of contents Select the heading to which you want to apply a heading style. On the Home tab, in the Styles group, click the style that you want.   Mark individual text entries Select the text that you want to include in your table of contents. On the Refere...

Run a SQL Script at runtime of a C# application

In my previous post I explained how to run a SQL Script using Command prompt. It is bit difficult. So I found a way to run the SQL script using the application. I used it on button click. Here is how I did it. 1.   Create your SQL Script. 2. Add the references below to your C# application using Microsoft.SqlServer.Server; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Sdk.Sfc; 3. Add the path to your SQL Script string Filename = Path .Combine( Environment .GetFolderPath( Environment . SpecialFolder .MyDocuments) + "\\Configuration\\" , "Create_Database.sql" ); 4. Add the code below to read your SQL Script StreamReader StreamReader;           StreamReader = new StreamReader (Filename); string CreateDBQuery = StreamReader.ReadToEnd(); 5. Create a connection with server & Execute Query string tempConnString= "Data Source=(local);Inte...

Find your Computer’s location with Windows 7 and Geosense

Windows 7 introduced the new Sensors and Location platform that would let Windows automatically respond to environmental changes sensed by light, orientation sensors, or GPS chips.  This makes your computer more aware of its surroundings and change itself accordingly.  The location platform is especially interesting, as it brings the potential of automatic location based search and maps to your PC.  Unfortunately, most laptops today are not equipped with GPS chips.  Thanks to Geosense, however, you can still use the location platform. Geosense uses IP lookup, Wi-Fi and Cell tower triangulation, and more to find your location as accurately as possible. Geosense lists itself as a sensor in the Windows Sensors and Locations, so once you’ve installed it, all location-aware applications and services will be able to pickup your location from it.  Please note that Geosense only works on Windows 7 Home Premium and higher, as Windows 7 Starter doesn’t include the Sen...