Re: Create SQL Db on SQL server
- From: Jon <Jon@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 9 Jun 2005 13:05:06 -0700
Thankyou Robert, so i just make "Initial Catalog=master"?
and could you mind explain more a bit how to grant the user permission in
code?
many thanks in advance.
"Robert Porter" wrote:
> To start with, the Initial Catalog can't point to a database that does
> not yet exist. Use "master".
>
> Secondly, once you create the database you will have to grant the user
> permissions to access the database before you can then log into it.
>
> Hope this helps....
>
> Bob
>
> Jon wrote:
> > Hi,
> >
> > I have tried to create a new DB on the SQL Server but unsucessful..
> > I have looked at the microsoft "How to create SQL Database in vb.net", but
> > it doesn't seems to solve my problem.
> >
> > below is the connection string that i used to create, but i get error saying
> > login has fails. I am sure the login works because i can read out data from
> > the SQL server no problem...
> >
> > Dim conn As SqlConnection = New SqlConnection("Initial Catalog= NewDB;" & _
> > "Data Source=SERVER-MACHINE;" & _
> > "UID=abcde;" & _
> > "PWD=abcde;"
> >
> > Dim cmd0 As New SqlClient.SqlCommand("CREATE DATABASE ON PRIMARY " & _
> > "(NAME = NewDB, " & _
> > " FILENAME = 'D:\Program
> > Files\Microsoft SQL Server\MSSQL\Data\" & m_date & ".mdf', " & _
> > " SIZE = 2MB, " & _
> > " MAXSIZE = 10MB, " & _
> > " FILEGROWTH = 10%) " & _
> > " LOG ON " & _
> > "(NAME = " & m_date & "_log,
> > " & _
> > " FILENAME = 'D:\Program
> > Files\Microsoft SQL Server\MSSQL\Data\" & m_date & ".ldf', " & _
> > " SIZE = 1MB, " & _
> > " MAXSIZE = 5MB, " & _
> > " FILEGROWTH = 10%) ", conn)
> >
> > so i wonder m i doing anything wrong???
> > Any help would be appreciated.
> >
> > many thanks.
> >
> >
>
.
- References:
- Create SQL Db on SQL server
- From: Jon
- Re: Create SQL Db on SQL server
- From: Robert Porter
- Create SQL Db on SQL server
- Prev by Date: Re: Create SQL Db on SQL server
- Next by Date: Excel COM Addin
- Previous by thread: Re: Create SQL Db on SQL server
- Next by thread: Re: Create SQL Db on SQL server
- Index(es):
Relevant Pages
|