G
Guest
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.
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.