Re: how to create database
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Tue, 25 Mar 2008 16:04:55 -0700
empire1986 (empire1986@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
Yeah, I googled it and found nothing. Can you tell me how can I do it with
sql server?
Dim cn As New OleDbConnection, _
strConn As String
AddHandler cn.InfoMessage, AddressOf OledbInfoMessage
' Connection string, change server and database!
strConn = "Provider=SQLNCLI;Integrated Security=SSPI;"
strConn &= "Data Source=(local);Initial Catalog=tempdb"
Try
cn.ConnectionString = strConn
cn.Open()
Catch ex As Exception
Console.Writeline(ex.Message, "Connection failed!")
cn = Nothing
Exit Sub
End Try
Dim cmd As OleDbCommand = cn.CreateCommand()
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "CREATE DATABASE nisse"
cmd.ExecuteNonQuery()
Not that I know Access, but I can't imagine that it can be that
different.
Then again, this forum is really about the native OLE DB API, and
not the OleDb .Net Provider. For general questions on ADO .Net,
microsoft.public.dotnet.framework.adonet is a better to ask in.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- Re: how to create database
- From: empire1986
- Re: how to create database
- References:
- Re: how to create database
- From: Mary Chipman [MSFT]
- Re: how to create database
- From: Mary Chipman [MSFT]
- Re: how to create database
- Prev by Date: Re: how to create database
- Next by Date: Re: how to create database
- Previous by thread: Re: how to create database
- Next by thread: Re: how to create database
- Index(es):
Relevant Pages
|