Visual Basic with SQL-database connection and Windows XP

When you work with Visual Basic 2005 Express Edition on windows XP, and if your application contains references to SQL-databases, I have discovered that it is important that all identities be logged off before you open the particular identity where you want to work on your Visual Basic project. I have earlier assumed that it was only possible to work with Visual Basic on one identity, the one where the version was registered.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

This assumption was not quite correct. Actually, you may run Visual Basic applications with SQL-references on all identities on XP, provided that no other identities that are using the SQL-server are currently running.

 

For example, suppose you start your computer and log on the identity James. Then you switch identity, but you actually don't log off James. Then you log on the John identity. There you discover that it is impossible to create a new SQL-database in Visual Basic's Data-connections view. An error message appears. Why is that It is because the SQL-server is busy on the James-identity. To solve this problem you want to log off the John identity, don't just switch. Then log on the James identity again, and log off properly. All identities should now be logged off. Now you may log on the John identity again, and it is now possible to create an SQL database.

 

Concerning deploying applications for XP. This issue is similar to the one I just described. You cannot run the installation-file successfully on one identity if the SQL-sever is busy on another identity. You want to log off all identities before logging on the identity where you want to install the application. Same thing when you want to run the deployed application.

 

Question. Does this limitation exist only in the express-editions of Visual Studio 2005 as a drag on free-ware, or is it prevalent in commercial editions as well  I would like to know a little more about this before purchasing the standard or professional edition of Visual Studio 2005.

 

Best Regards

Ziper




Answer this question

Visual Basic with SQL-database connection and Windows XP

  • Ben Chambers

    I am a little confused by your description. What do you mean when you say that you are switching identities and what do you mean by identity (is it a SQL Server login, or a Windows login with access to SQL Server, or is it something different). What is the error message that you receive when attempting to create a new database

    Assuming that by identity you mean a login, it is possible to have several logins connected to SQL Express doing work in parallel; there is no special restriction about this.

    For additional information on SQL Server Express and on the differences between this and other editions, take a look at: http://msdn.microsoft.com/sql/express/.

    Thanks
    Laurentiu



  • PK14

    Thank you for your message Garcia. I have created two new XP-Users on my computer without passwords and with administrator privileges like in your testing environment. But when I switch from user A to user B it is no longer possible for me to create a new SQL database in Visual Basic data connection view. < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

     

    I suggest you following the steps below in order to create a testing environment as similar to mine as possible.

     

    1. Uninstall Visual Studio 2005 and all .Net components and SQL server 2005 on your computer, or change to a different computer which does not have these components. Restart computer.

    2. Install Visual basic 2005 Express Edition from the following Link

    http://msdn.microsoft.com/vstudio/express/vb/download/. Restart computer.

    3. Log in as User1

    4. Open Visual Basic 2005 Express.

    5. Select Database Explorer under the View Menu.

    6. Select Data Connections- Right Click- Add connection.

    In the Add Connection Window, I can read

    Microsoft SQL Server Database File (SqlClient)

    If I click Advanced my DataSource is

    .\SQLEXPRESS

    7. Type a name of the database and click OK. Choose to Create new

    database.

    This should work alright.

    8. Close Visual Basic Express and switch to another user (do not log off).

    9.Repeat steps 4-7. An error message should occur on (7) when you try to create a new database.

     

    Here are some additional information about my computer:

     

    computer name     : COMPAQ
    operating system  : Windows XP Service Pack 2 build 2600
    processor         : Intel(R) Pentium(R) 4 CPU 2.40GHz

    total physical memory   : 759 MB
    free disk space   : (C:) 11.66 GB

     

    The computer is included in a local network with 2 computers. Internet Information Services (IIS) is probably disabled.  

     

    Thanks,

    Ziper

  • Jon Braganza

      I am trying to reproduce the problem you reported on my machine without any luck so far. Allow me to describe how I have set up my test environment and the steps I tried, it may be possible that there is a discrepancy between the two environments or that I am missing/misinterpreting something from your scenario.

      Environment:
    * Windows XP Pro (SP2 + latest security updates)
    * 2 system administrator Windows users (no passwords), not connected to any Windows Domain
    * Visual Studio 2005 (Std. edition, default settings)

    Steps:
    * Login on the box as User1
        o Create a new Visual studio, create a new VB Windows application project.
        o Data -> Add New data Source
        o Select Database, click on  “New connection”
        o Use “Microsoft SQL Server Database File” as data source
        o Type an arbitrary name for the database file name (file1), click YES to create a new file
        o Click NEXT on the wizard (choose your data connection)
        o Click YES on the following message box (default)
        o Click Next, The “Choose your data objects” form shows up
        o Finish

    * Switch user (without logging off from user1) to User2

        o Repeat the same steps, browse for “file1” as the DB file name.

    On my tests, both Windows users are able to create the new Data Sources successfully. We will appreciate any additional information you can provide us.

    Thanks a lot,

    -Raul Garcia
     SDE/T
     US-SQL Server Engine

    --------------------------------------------------------------------------------

    This posting is provided "AS IS" with no warranties, and confers no rights.

     



  • Syam

    I just find out we have already identified this as an existing problem on the product and we are working on a fix. The bug fix should be included as part of SQL Server 2005 SP1.

    Once again thanks a lot for your feedback.

    -Raul Garcia

    SDE/T

    US-SQL Server Engine

    --------------------------------------------------------------------------------

    This posting is provided "AS IS" with no warranties, and confers no rights.



  • Fortaz

    I don't have a full answer right now. I'll have to investigate this further. But here's some information that might help in the meantime.

    User instances are a feature specific to SQL Server Express. The Express site discusses them here:

    http://msdn.microsoft.com/sql/express/default.aspx pull=/library/en-us/dnsse/html/sqlexpuserinst.asp

    The limitations on SQL Server Express are described in this article (see Engine Specifications section):

    http://msdn.microsoft.com/sql/express/default.aspx pull=/library/en-us/dnsse/html/sseoverview.asp

    What you are seeing is definitely not an intended limitation on Express. In fact, several users should be able to connect simultaneously to SQL Server Express; try logging in from another machine, for example. What you are seeing looks like a conflict between the Express user instance feature and the Windows fast-switch feature. I have not used fast-switching often, and I'll need to do some research and testing to figure out what is going on in this scenario. I'll reply to this thread when I'll have more information.

    Thanks
    Laurentiu



  • jph290

    < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    I am sorry if my message was not clear enough. ‘Identity’ means a User on Windows XP. You log on to the computer as a User, for example as an Administrator. John and James were just arbitrary users who I chose to illustrate my description.

     

    When you have started the computer, the XP-welcome screen appears. On the welcome screen, all the users are listed next to icons. If a user is currently logged on, the text ‘logged on’ appears just below the text of the user. Switch User is the mechanism that  allows switching between the logged in users. When I said something about switching identity without logging off I just meant switching user instead of logging off. When you click ‘Log off’ on the start menu, the “Log off Windows”-box appears where you may either switch user or log off.

     

    Concerning the error message that appears when I fail to create a new SQL-database.  Here is the message:

     

    Microsoft Visual Basic 2005 Express Edition

    Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

     

    I hope this will clarify my previous message somewhat.

     

    I looked at the site you suggested Laurentiu, but I couldn’t find any information concerning this matter. I still would like an answer to the question I put in my previous message. I have made very thorough verifications of the statement from my previous message (actually, I have tried to create SQL-databases in VB-Express on two different Windows XP-computers), and it is definitely true that I cannot log on to one user, then switch to another user and create a SQL database from that user. You have to log off all users first, before logging on again.

     

    I would like to conclude this message by describing how I create SQL-databases in Visual Basic 2005 Express. I just right click on data-connection in the Data-Explorer window.(This window may have some different name in Visual Studio 2005 professional/Standard). Then I choose ‘Add connection’.  The default datasource is ‘Microsoft SQL Server Database File (SqlClient)’

     

    I retain the ‘Use Windows authentication setting’ and choose browse. Then I choose a filename, and when I close the dialog-box by clicking OK Visual Basic offers to create the database which it could not find on the disk.

     

     

    Thank you very much.

    Ziper

     



  • Visual Basic with SQL-database connection and Windows XP