How to Create a Database From a Webpage

How to Create a Database From a Webpage thumbnail
Create a database in your website code.

Databases contain the dynamic content used in web pages. You can create a web database on-the-fly as well. This is beneficial if you develop large applications. Your client installs the application on the web server along with a database that holds the client's data. This makes installation of the application completely dynamic, so each client can install a database specific for his needs.

Instructions

    • 1

      Create your database server connection variable. This variable connects to the server and provides you with an interface to the server. The following code sets up this variable:

      Dim conn As SqlConnection

      connstring= "Integrated Security=SSPI;Data Source=localhost;"

      conn.ConnectionString = connstring

      conn.Open()

    • 2

      Create the SQL string that executes a "create database" command. You can execute any SQL commands on your database server. The "create database" command creates a physical database on the server. The following code creates this command variable:

      sql = "create database myNewDatabase"

      Replace "myNewDatabase" with the name of your database you want to create.

    • 3

      Execute the command. Executing the command creates the database on your server. Enter the following code to create the database:

      Dim cmd As SqlCommand

      cmd = New SqlCommand(sql, conn)

      cmd.ExecuteNonQuery()

Related Searches:

References

  • Photo Credit laptop with database record on 15.4" wide screen image by .shock from Fotolia.com

Comments

You May Also Like

Related Ads

Featured