CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,900

    Trying to Work with MSDE

    I have spent megabucks buying a book called MSDE Bible and they have started the book by not telling how you create a database (with all the exact steps required so you can actually work with it. I find this highly unprofessional, and wonder if the authors David C Walls and Denise M Gosnell actually know anything about teaching. (One enormally teaches step 1 before step 2 where I come from - obviously not in America).

    Anyway, later on in the book there is an example on creating a database.

    My problem is that it does not work because I do not understand what is required in terms of security clearance / user names / passwords / user authority. (They also assume you know all about that too).


    All I have done is installed MSDE 2000 Rel A and am now trying to use it. The only question I was asked during the install was to define a "Strong Password" and thats all.

    I am now attempting to

    1) Create a Database
    2) Create a table with some fields
    3) See if I can access the database

    Now is that too much to ask ?


    Here is the code that supposedly creates the database:

    The problem is in the connect - something to do with security of some sort that is completely overlooked.



    dim oMSDEserver
    dim oDatabase
    dim oDataFile
    dim oLogFile

    set oMSDEserver = CreateObject("SQLDMO.SQLServer")
    set oDatabase = CreateObject("SQLDMO.Database")
    set oDataFile = CreateObject("SQLDMO.DBFile")
    set oLogFile = CreateObject("SQLDMO.LogFile")

    oDatabase.Name = "scheduling"

    oDataFile.Name = "sched_data"
    oDataFile.PhysicalName = "c:\mssql7\data\sched_data.mdf"
    oDataFile.Size = 5

    oLogFile.Name = "sched_log"
    oLogFile.PhysicalName = "c:\mssql7\data\sched_log.ldf"
    oLogFile.Size = 3
    oLogFile.MaximumSize = 50

    oDatabase.Filegroups("PRIMARY").DBFiles.add(oDataFile)
    oDatabase.TransactionLog.LogFiles.add(oLogFile)

    oMSDEserver.connect "0kh2h","sa","" <<<<<< PROBLEM HERE
    oMSDEserver.databases.add(oDatabase)
    oMSDEserver.disconnect





    I have not done anymore than install MSDE and run this code - what steps have I missed please ???

  2. #2
    Join Date
    Apr 2004
    Posts
    18
    What's the error that you're getting when you attempt to connect? By default, (I believe) MSDE installs in Windows authentication mode meaning that you're logon to Windows is sufficient to provide authentication to the database server. That means that you do not have to supply a user name and password to connect. If you are using Win9x then you must use SQL Server authentication (you have to supply a user name and password.) Try going to a command prompt and type

    osql -E

    If you get a 1> prompt then you're connected using Windows authentication. Otherwise, post the message returned.

    The switches to osql are case sensitive. -E means "use trusted connection"; -e does not.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured