Results 1 to 14 of 14
  1. #1
    Join Date
    Apr 2006
    Posts
    5

    Unanswered: CREATE TABLE in wrong database (Master)

    I am using ASP.NET and a normal ODBC stringconnection

    Driver={SQL Server};Server=(local);MyBase;Uid=;Pwd=;Trusted_Co nnection=;

    when trying to CREATE a TABLE (with vb.net code) I get an error because the TABLE are written in Master !! and not in MyBase

    i am using windows authentication

    what can be wrong ?

    thank you
    Last edited by siamloin; 04-19-06 at 13:08.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Your default db will be master. You need to name your params in the string. How about:

    Code:
    Driver={SQL Server};Server=(local);Database=MyBase;Uid=;Pwd=;Trusted_Connection=;
    ???

    EDIT - BTW - do you not need to put True after trusted connection or does that work?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    And....

    never need to ask a connection string question of anyone again:
    http://www.connectionstrings.com/
    http://www.carlprothman.net/Default.aspx?tabid=81

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Apr 2006
    Posts
    5
    my connection string is perfect .. it is not a connectionstring problem

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    No it's not. Have another look. MyBase is just floating there. And Trusted Connection, Uid and Pwd are parameters without values.

    Check the links.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by siamloin
    my connection string is perfect .. it is not a connectionstring problem

    So.....

    Why are you asking for help then?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Brett Kaiser
    So.....

    Why are you asking for help then?
    It's perfect... That doesn't mean that it is working.

    -PatP

  8. #8
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    You could also set the default for the userid to the database you want the table(s) written to. Then the default would be MyBase instead of Master.

    Lookup sp_defaultdb in BOL.

    -- This is all just a Figment of my Imagination --

  9. #9
    Join Date
    Apr 2006
    Posts
    5
    this connecting string is working fine since 6 months, i have installed MS SQL 2005 on MS SQL 2000 and it doesnt work any more, it is not a connectionString problem
    it is a database rights problem, and a microsoft problem too

  10. #10
    Join Date
    Apr 2006
    Posts
    5
    Quote Originally Posted by tomh53
    You could also set the default for the userid to the database you want the table(s) written to. Then the default would be MyBase instead of Master.

    Lookup sp_defaultdb in BOL.
    there is no UserId no password I am using windows authentication

    what do you mean by Then the default would be MyBase instead of Master.

    do you mean the user account ? I am using only one user account for all my databases

    thank you

  11. #11
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Whatever account you use (SQL or NT) to connect to SQL Server will have a default database assigned to it. If you don't specify a database in your connection string you will connect to the default database. You have not specified a database in your connection string (however perfect it may be) so you are connecting to your default database, typically master (master is the default default database ). So - either specify a database in your connection string or change your default database in SQL Server.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  12. #12
    Join Date
    Apr 2006
    Posts
    5
    it works now !!

    thank you

  13. #13
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by siamloin
    this connecting string is working fine since 6 months, i have installed MS SQL 2005 on MS SQL 2000 and it doesnt work any more, it is not a connectionString problem
    it is a database rights problem, and a microsoft problem too
    Ah - just realised your problem - I bet in 2000 the default db was set up but not in 2005 eh? Seriously - the MyBase bit in your connection string is doing nothing - I'm surprised it didn't throw an exception to be honest.

    Glad to have helped
    Testimonial:
    pootle flump
    ur codings are working excelent.

  14. #14
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by siamloin
    it works now !!

    thank you

    Must be the miracle connection string....

    And I'm sure you didn't change a thing....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •