Portfolio

Friday, October 9, 2015

How to Create a ASP.NET Web App and SQL Server Database



This local ASP.NET application will migrate to Azure while importing a database from SQL Server Management Studio. 

  • First, we want to connect to SQL Server Management Studio.  
  • Create a new database by right clicking on database to the left under object explorer.
  • Name it Local Database 
  • Add a new table by right clicking on table and name it Employee
  • Right click on the Employee table and edit top 200 rows
  • Now we want to fill the fields:
  • Name the first cell EmployeeID, int, uncheck to allow nulls
  • Next field should be First Name, nvarchar(50), null
  • Next field should be Last Name, nvarchar(50), null
  • Save the table as People if haven't named it yet
  • Enter a couple of names:
  • The first could be you For example, Bob Jones
  • Next could be Vince Neil or what ever you might choose
  • Under the programmability folder click the plus + sign and right click stored procedures
  • New-then stored procedures
  • a new query should pop up
  • delete all the content and put in this syntax query instead. 
  • USE [Employee]
    GO

    DECLARE    @return_value int

    EXEC    @return_value = [dbo].[AzureSP_GetEmployeeInfo]

    SELECT    'Return Value' = @return_value

    GO
Next, you want to start a new web application in Visual Studio.











Double click on the default.aspx file on the right under the Solution Explorer panel.
Delete one of the content under ASP.NET

Then on the left side under Server Explorer Connect to your database, then put in your database name
It should be on your main login in SQL Server











Then enter your database
Enter your table name and you should see a list from your database

Next drag and drop your table onto your web form











Then run your program and it should show up in the browser.
If you have any questions please send me a message below regarding this tutorial, thank you.

No comments:

Post a Comment