hai friends,
I dont know how to create database dynamically in vb.net.(if a button is clicked 4 databases in access or sql has to be created).similarly by clicking the delete button the specified database should be deleted.can you help me out with the coding.

[code = VB.NET]
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim con As SqlConnection
        Dim sql As String
        Dim cmd As SqlCommand

        con = New SqlConnection("Server=urserver;" & "DataBase=;" & "Integrated Security=ur security;")
        sql = "CREATE DATABASE ABC  ON PRIMARY" + "(Name=abc_data, filename = 'C:\MSSQL7\data\abc.mdf', size=3," + "maxsize=5, filegrowth=10%)log on" + "(name=abc_log, filename='C:\MSSQL7\abc_log.ldf',size=3," + "maxsize=20,filegrowth=1)"
        con.Open()

        cmd = New SqlCommand(sql, con)

        Try
            cmd.ExecuteNonQuery()
            MsgBox("DATABASE Created")
        Catch ex As Exception
            MsgBox("Database Already Exists!")
        End Try

    End Sub
This question has already been answered. Start a new discussion instead.