ASP Web Hosting | Windows Hosting Technology News

Archive for the ‘ASP.NET Know How’ Category

Microsoft ASP.NET

Simple Description of ASP.NET 3 Layers Architecture

Layer 1 – ASP.NET Presentation Layer – Presentation Layer is responsible for displaying user interface to either programmer or end user. Programmer uses this layer for designing purpose and to get the data back and forth. In ASP.NET it includes ASPX pages, user controls, server controls and sometimes security related classes and objects.

Layer 2 – ASP.NET Business Layer – The Business layer works as a mediator to transfer the data from presentation layer. In the three tier architecture the data access layer is not made to interact with the presentation layer. The architecture in ASP.NET includes using SqlClient or OleDb objects to retrieve, update and delete data from SQL Server or Access databases and passing the data retrieved to the presentation layer in a DataReader or DataSet object, or a custom collection object. The Data layer gets the data from the business layer and sends it to the database or vice versa.

Layer 3 – ASP.NET Data Layer – The Data layer gets the data from the business layer and sends it to the database or gets the data from the database and sends it to the business layer. In ASP .NET it is an SQL Server or Access database. It can also be Oracle, mySQL or even XML.

These 3 layers plays an important roles on making the ASP.NET technologies fully functional including all ASP.NET hosting websites software.

Advertisements

ASP.NET Application

Simple Steps to Create SQL Database Connection in ASP.NET

** This guide is ideal for using C# codes only. Other scripts such as VB.NET will be described in other posting.

1: Open visual studio 2008 and from FILE select NEW-> WebSite, then from pop-menu select asp.net website (Note: Language must be C#) , then press OK.

2: Now create three textboxes from the toolbox , to remove ambiguity I am using default name for that textboxes and that should be textbox1,textbox2 & textbox3. And also drag & drop the button to the asp.net application.

3: Meanwhile, Open SQL SERVER Management studio 2008 and open databasename(or you can create your own database by the Sql command CREATE DATABASE database_name)

4: Then create table by clicking right mouse button and form three column, Name them according to your requirement , for your information only I used EID,name,Address. And click save button, then you’ll get a pop up menu where you have to enter the Table Name, for this example I used students.

5: Now Come Back to Visual studio Application and write the following code in the button_click event

protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection myConn = new SqlConnection();
myConn.ConnectionString = “Connection string(See Below for this — )COPY PASTE HERE“;

myConn.Open();
string strqry = “Insert into students values (” + TextBox1.Text +
“,’” + TextBox2.Text + “‘,’” + TextBox3.Text + “‘)”;

SqlCommand myCom = new SqlCommand(strqry, myConn);
int numrow = myCom.ExecuteNonQuery();
myConn.Close();

}

You are invited to include your comments on the steps mentioned above of please write in another methods of accomplishing the objective stated above. Thank you.


Follow SeekDotNet on Twitter

Web Hosting Categories

Top Clicks

  • None
December 2017
M T W T F S S
« Sep    
 123
45678910
11121314151617
18192021222324
25262728293031