Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Creating database from code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Creating database from code

 Post Reply Post Reply Page  <12
Author
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2006 at 11:48pm
Thanks Michael, it works fine, however I'm puzzled why my code didn't and I think the problem may lay in this:
 
In your connection string, it is like this: Server=(local) and in mine it was Server=localhost, maybe this was the problem, also what is this: Create Database [{0}] whats the funny 0 doing there?
 
I gave this user permissions to create databases, as it stands this user is also a dba, I will remove priviledges untill the user can only create databases and do all the normal operations with it. I don't think the user need access to the master database, but will try removing it, if he does this could be a problem as users could then access this crutial database just to create another database.
 
Thanks guys.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 07 October 2006 at 8:05am
Basically Server=Localhost will only work for the full SQL Server 2000 edition. (local) will work for both MSDE and SQL Server 2000 connection strings.

The {0} is a format string. Basically what it is saying is place the value of the first parameter to the string.Format function here... i.e.

string helloWorld = string.Format("Hello {0}!", "world");

is equivalent to

string helloWorld = "Hello world!";

It just saves a lot of string concatation
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 07 October 2006 at 8:40am
Ahh, got it, 0 would be 'world' as in first element of an arrays.
 
Thanks guys.
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.