Results 1 to 7 of 7

Thread: Create Sql server DataBase by vb6

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    3

    Create Sql server DataBase by vb6

    this my first thread

    this Simple code use for create sql server database , you can enter any name to the textbox in this code .....

    the controls

    Textbox 1 , Button


    references

    Microsoft Activx Data object 2.0

    PHP Code:
    ' in general section 

    Dim cnn As ADODB.Connection
    Dim rst As ADODB.Recordset 
    in command click event this code

    PHP Code:

    Private Sub Command1_Click()

    Set rst = New ADODB.Recordset
    Set cnn 
    = New ADODB.Connection

    cnn
    .ConnectionString "Provider=SQLOLEDB.1" _
    ";Integrated Security=SSPI;Persist Security Info=False;" _
    "User ID=Gihad alariqi;Initial Catalog=gehad;" _
    "Data Source=GIHAD\SQLEXPRESS"

    '"Data Source=GIHAD\SQLEXPRESS;Initial Catalog=gehad;Integrated Security=True "
    cnn.Open

    rst.Open "CREATE DATABASE " & Text1.Text & "", cnn

    End Sub 
    regards

  2. #2
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: Create Sql server DataBase by vb6

    Ok? So you can create a database using ADO.
    Why did you post this?

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Create Sql server DataBase by vb6

    Moved to the CodeBank

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,501

    Re: Create Sql server DataBase by vb6

    bleh.... and using a recordset to do that too.... better to use a Command object then .Execute it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: Create Sql server DataBase by vb6

    Quote Originally Posted by Hack
    Moved to the CodeBank
    Move to trashcan instead

  6. #6
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    Re: Create Sql server DataBase by vb6

    i think a name change is required on this ??

    Dav

  7. #7
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,501

    Re: Create Sql server DataBase by vb6

    Don't get me wrong... I mean it'll work.... it's just not the way one would go about doing it generally.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width