In all lessons with a SQL Server database connection, you will have a Connection string supplied to you with the database and table SQL scripts so that you can follow along with the code provided in the lesson.
(The below names will change depending on the lesson you are doing, but all will be similar)
SQL Server.
Step 1:
Create a new Database named, [
Test]
Right-click on [
Databases]
Choose [
New Database]
When Dialog opens.
Database Name:
TestChoose [
OK]
Step 2:
Create a new SQL Server Database user named , [
testuser]
Right-click on [
Security]
Choose [
New] | [
Login]
Login name:
testuserSelect [
SQL Server authentication]
password:
testuserconfirm password:
testuserUnder [
Select a page]
Choose [
Server Roles]
Add a check to [
sysadmin]
Next
Choose [
User Mapping]
From the [
User mapped to this login]
Choose the [
Test] database.
Click [
OK]
Step 3:
Right-click on the new database [
Test]
Choose [
New Query]
Copy and Paste the code from the [
SQL] tab into the Query window, and click on [
Execute]
You should now have a table called Tags with nine records.
Step 4:
Create our connection string to our newly created database.
In a new file, copy and paste the code.
Classic ASP
Top of the [
ASP] tab and save the file as
ACN.aspTop of the [
ASP.NET] tab and save the file as
database.configThe below items need changing to your system specs.
- [getServer] = this is the Computer (or) Server name.
- [getInstance] = This is the SQL Server instance name.
- [getID] = Username of the SQL User
- [getPW] = Password of the SQL User
- [getCat] = The name of the Database
Classic ASP (Copy and paste and save as ACN.asp)
VB and C# (Copy and paste and save as database.config, then refer to this file from Web.config)