Advertisement

05.29.2008 at 09:31AM PDT, ID: 23442037
[x]
Attachment Details

How to change this function to make it check if the database is already exist if not then create it?

Asked by Abdu_Allah in Programming for ASP.NET

Hi, how to change this function to make it check if the database is already exist if not then create it?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Sub createDB(ByVal server As String, ByVal database As String, ByVal uid As String, ByVal pwd As String)
        Dim connectionString As String = "server=" + server + ";uid=" + uid + ";pwd=" + pwd
        Dim objConnection As New SqlConnection(connectionString)
        If objConnection.State = 0 Then _
            objConnection.Open()
        Dim ObjCommand = New SqlCommand("CREATE DATABASE " + database, objConnection)
        'ObjCommand.
        'ObjCommand.CommandText = sCmd
        ObjCommand.executenonquery()
        objConnection.Close()
    End Sub
[+][-]05.29.2008 at 10:37AM PDT, ID: 21671413

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.29.2008 at 11:58AM PDT, ID: 21672240

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Programming for ASP.NET
Sign Up Now!
Solution Provided By: sinoj
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.29.2008 at 01:43PM PDT, ID: 21673116

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628