Re: Creating a database
- From: "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx>
- Date: Fri, 22 Sep 2006 19:41:18 +0200
Adrian,
Try something as this from an old program of me,
cmd.CommandText = _
"CREATE PROCEDURE InsertMessage " & vbCrLf & _
"@Answer ntext, " & _
"@Problem nvarchar " & vbCrLf & _
"AS" & vbCrLf & _
"INSERT INTO tblMessages (Problem, Answer) VALUES (@Problem, @Answer)"
cmd.ExecuteNonQuery()
I hope this helps,
Cor
"Adrian" <00@xxxxx> schreef in bericht
news:45138b7c$0$739$5fc3050@xxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a text on Stored Procedures.
My questions were the following
(1.) The code below does not have "CREATE PROCEDURE" in it, as my text on
SP
tells me Stored Procedures should have.
Question: "Is the code below a Stored Procedure after all?" Yes / No.
The code:
USE master
GO
CREATE DATABASE Products
ON
( NAME = prods_dat,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\prods.mdf',
SIZE = 4,
MAXSIZE = 10,
FILEGROWTH = 1 )
GO
Answer "No"
(2.) The code has been taken from MDSN and is Transact SQL. If it isn't a
SP
then I should be able to stick the code into a CommandText string and do
an
ExecuteNocQuery. However if I want to create a database, that database is
not going to be there in the first place, so what do I put in the connect
string, since the connect string has to specify a database name?
Answer "Yes"
Question A.
Stored Proceduers seem to need "CREATE STORED PROCEDURE".
Question: how do I get the code to comply to the stored procedure cyntax?
Question B.
I can create a stored procedure from within the Server Explorer and from
SQL
Server Manager Studio Express. From within VS I have to follow this route
according to a text I have: File -> New Project -> C# ->Database -> SQL
Server Project. I do not have these options in my VS Standard Edition. Is
it
still possible to create a SP in my VS Standard Edition without these
options (not using the two methods I have already stated, viz: from within
the Server Explorer and from SQL Server Manager Studio Express)?
.
- References:
- Re: Creating a database
- From: Cor Ligthert [MVP]
- Re: Creating a database
- Prev by Date: Re: Whats going on with the DAAB and UpdateDataSet?
- Next by Date: Re: Access / DAO - What's the Future
- Previous by thread: Re: Creating a database
- Next by thread: Re: Creating a database
- Index(es):
Relevant Pages
|