Saturday, June 23, 2007

Visual Studio 2003 & 05

Visual Studio 2003 & 05

The first head ache i found is installing visual studio as it is a bit lengthy process...Visual studio needs some prerequisites..So we can install Visual Studio only after installing the prerequisites....The prerequisites includes


Internet information service(IIS) with front page extension

1.Go to control panel.Switch to classic view if you are not in classic view
2.Take add or remove programs.
3.Take add/remove windows components from the left panel.
4.Tick Internet Information Service from the list.
5.Highlight IIS and click Details link in the bottom
6.In details page tick all the options and click OK.
7.Click Next...and the components will start installations.Insert WIndows XP Cd when its asked for..

Other Prerequisites(Dot net framework)

1.Put Visual studio cd no :1
2.It will check for the prerequisites .
3.Insert the prerequistes cd when asked for.
4.Follow the instructions .(Simple steps)



IIS Errors-Unable to debug

If you installed IIS after installing dot net framework,then you wont be able to debug the project in visual studio...





Reason
The IIS is not configured with asp.net .Simply IIS dont know what is asp.net..SO we will have to link IIS with our dotnet framework.


Solutions

First Solution

1.Take start >Run
2.Copy the code below and press Ok

"H:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe" -i



Replace 'H' with the drive in which your windows is installed.
Replace v1.1.4322 with the version of your dotnet framework

Trouble shooting --->If this is not working the take search and search for the file aspnet_regiis.exe ....If found copy its address,compare it with the code above and rewrite the code...DOnt forget to write '-i' at the end



Second Solution

If you dont understand the first solution then simply reinstall dotnet frame work

It will be in the Visual Studio Prerequisite CD....No need to reinstall entire Visual Studio

Installing Sql Server 2000

To Install SQL Server 2000 Basic Local Installation.

1.Insert the Microsoft SQL Server 2000 cd in your CD-ROM drive (if the compact disc does not run automatically, double-click Autorun.exe in the root directory of the compact disc), select SQL Server 2000 Components, and then select Install Database Server. Setup prepares the SQL Server Installation Wizard. At the Welcome page, click Next.

2.In the Computer Name dialog box, Local Computer is the default option, and the local computer name appears in the text box. Click Next.


3.In the Installation Selection dialog box, click Create a new instance of SQL Server, or install Client Tools, and then click Next. Follow directions on the User Information, Software License Agreement and related pages. In the Installation Definition dialog box, click Server and Client Tools, and then click Next.

4. In the Instance Name dialog box, if the Default check box is available, you can install either the default or a named instance(the default user name is 'sa'). If the Default check box is not available, a default instance has already been installed, and you can install only a named instance. • To install the default instance, click to select the Default check box, and then click Next.

5 To install a named instance, click to clear the Default check box, type a new named instance in the Instance Name box(dont forget this username and password.This will be ther user id and password used to establish connection to the sql server from asp.net page), and then click Next.


6. In the Setup Type dialog box, click Typical or Minimum, and then click Next.

7. In the Service Accounts dialog box, Select Local machine and click next(If you are using sql server to create databases directly on your web domain,then give your user id and password in this step)

8. In the Choose Licensing Mode dialog box, make selections according to your license agreement, and then click Continue to begin the installation. In the Setup Complete dialog box, click Yes, I want to restart my computer now, and then click Finish.

Creating database using Sql server 2000

Creating database in sql 2000 is a very simple process.You can do this in two ways

By using Query analyzer

1.Take start>All programs>Microsoft sql server>query analyzer


2.Give userid and password of sql server that you set during installation
Tick the box "Start sql server if stopped"



3.Now you can write the queries to create tables and database in the white part.

4.To execute the query..select the query and press f5.






Using Enterprise manager






1.Take start>all programs>Microsoft sql server>Enterprise manager
2.On the left panel select Microsoft sql server>sql server group>(local)(windows NT)
3.To create new database ,right click on the database and there is an option to create new database there.
4.To create a new table ,select the databae name>Right click on tables >New table

5.A new pop up window will open.On that window give the necessary column names and datatypes

Creating auto incrementing columns


Autoincrementing columns are columns whose value is incremented each time a new row is entered into a table .

This is useful for generating a unique id automatically for each entry.


Steps

1.ON the page design pop up window in enterprise manager.Create a new column


2.Make its datatype as int


3.On the bottom maket identity 'Yes'

4.Set identity seed and identity increment to your desired values .






Basics of coding

Basics of coding



Code to establish Sql Connection

imports system.data.sqlclient // importing class library

dim con as new sqlconnection("server=.;uid=sql userid;pwd=sqlpassword;database=databasename")


'con' means connection name(You can give any name)

Code to declare an sql command

dim cmd as new sqlcommand("",con)


Code to declare sqldata adapter

dim ada as new sqldataadapter(cmd)


Code to declare datatable & dataset


dim dt as new datareader
dim ds as new dataset


Code to declare datareader

Dim dr As SqlDataReader

***We are not creating a new datareader..so there is no 'new' command in the above code

Where to write this code




Data Insertion

In this chapter let us examine how to insert data into a table from a webform

Suppose we have a text box named 'sname' and a button named 'insert' .Our aim is to
insert the value in the text box to the table named 'reg' when the button is clicked



steps

1.
Establish the connection
2.Double click on the button

Since the event is to happen when the button is clicked,the code for insertion should be written below buttons click event heading.When you double click on the button,you will be guided to this location



Code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click (No need to write the above line.It will be there)

con.open()
//open the connection
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into reg values('" & Me.sname.Text & "')"

//code to insert
cmd.ExecuteNonQuery()
con.Close()