Create Sql server DataBase by vb6
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
' in general section
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
in command click event this 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:

