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:wave:
Re: Create Sql server DataBase by vb6
Ok? So you can create a database using ADO.
Why did you post this?
Re: Create Sql server DataBase by vb6
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
Re: Create Sql server DataBase by vb6
Quote:
Originally Posted by Hack
Moved to the CodeBank
Move to trashcan instead :p
Re: Create Sql server DataBase by vb6
i think a name change is required on this ??
Dav
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