TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jirr Meynor
NA
22
0
Cannot find database
Nov 13 2011 9:01 AM
Hi,
I've created a database using this Stored Procedure.
ALTER PROCEDURE dbo.StoredProcedure1
(
@DatabaseName VARCHAR(50) = 'SampleDB'
)
AS
BEGIN
SET NOCOUNT ON
EXECUTE('CREATE DATABASE ' + @DatabaseName);
END
Executed it in ASP.net web page
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=<local computer path>\App_Data\ssdb_main.mdf;Integrated Security=True;User Instance=True");
con.Open();
SqlCommand dbc = new SqlCommand("StoredProcedure1", con);
dbc.CommandType = System.Data.CommandType.StoredProcedure;
dbc.Parameters.Add(new SqlParameter("@DatabaseName", "MyNewSampleDB"));
dbc.ExecuteNonQuery();
con.Close();
It executed successfully but I cannot find the database. I rerun it and it says it that the database has already existed? Where can I find it? I tried in C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA AND C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA but the database is not in there..
Help anyone?
Thanks
Reply
Answers (
6
)
C# Best Compatible
How to showing a modal popup extender for confirmation of a delete