473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

createing database problem

Dear all while I am trying to create database..I got these error

An attempt to attach an auto-named database for file C:\Documents and Settings\John Khalil\Desktop\s.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

here the code to create the database
Expand|Select|Wrap|Line Numbers
  1. SqlConnection temp = new SqlConnection(@"Data Source=.\SQLEXPRESS;Database = master;Integrated Security=True;Connect Timeout=30;User Instance=True");
  2.  
  3.             string query = string.Format(" CREATE DATABASE "
  4.                        + name
  5.                        + " ON PRIMARY " 
  6.                        + " (NAME = " + name +", "
  7.                        + " FILENAME = '" + path +"', " 
  8.                        + "User ID = " + user
  9.                        + "Password =" +pass
  10.                        +")");
  11.             SqlCommand command = new SqlCommand(query, temp);
  12.  
any idea?
Mar 9 '09 #1
1 1246
ck9663
2,878 Expert 2GB
Well, is it already existing?

-- CK
Mar 10 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Graham Taylor | last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it here also, as I think it might be the webserver which is causing my problem. --------- I have an Access 2003 database...
2
by: Robert McGregor | last post by:
Hi all, I've got a Front End / Back End database that was working just fine. One day i opened the FE to find that if I tried to open one of the linked tables from the database window, nothing...
2
by: Omavlana Omav | last post by:
Hi, I have created a datatable, dataadapter, added the table to a dataset and filling the table. Here I want to add an identity column to the above datatable and Later I will use this...
5
by: David Thielen | last post by:
Hi; I am creating png files in my ASP .NET app. When I am running under Windows 2003/IIS 6, the file is not given the security permissions it should have. It does not have any permission for...
1
by: ScottB | last post by:
When creating website applications within Visual Studio 2005, I use the File System method because it meets the needs of our environment. In choosing the location of the directory where the files...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
12
by: Steve | last post by:
I have a database that raises an error when you try to open it and it doesn't open. Trying to open the database with the OpenDatabase method raises the same error. Trying to import any objects...
1
by: bsg92150 | last post by:
i have a task that requires me to provide a web use with the ability to send teh current page to a power point slide. and to further complicate matters. the user may want to put the whole site...
2
by: Mick Walker | last post by:
I am interested in creatign a httpmodule that will log all IIS requests to SQL Server. I am just wondering, how would I be able to log bad requests such as 404 etc? Would I have to change the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.