Results 1 to 6 of 6

Thread: Ahhh!! major problem.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    Ahhh!! major problem.

    So I built my application yesterday, with the Setup and Deployment package.

    Everything was fine and worked installed awesome on my friends computer (vista).

    But when he tried running a form that retrieves clients via LINQ it gives the following error:

    http://www.briteon.net/ccscrenerror26.jpg

    But when he tries to add a client, it works fine (using the same db)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Ahhh!! major problem.

    That's just an SqlException. It gives the same message for all sorts of different issues. That information is just a general suggestion of something to check and is not specifically related to your error. You should be using a Try...Catch block to trap the exception and examine the information it provides to determine exactly what the issue is. The SqlException class provides far more information than just its Message property. Use it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    Re: Ahhh!! major problem.

    Alright thanks.
    I never experienced that error. In my application.vb event file I've just made sure to messagebox.show the unhandled exception. I dont know where it's occuring..

    It runs perfectly fine on my comp.. both in debug and release mode.

    how can i figure out what to do?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Ahhh!! major problem.

    You aren't showing the unhandled exception. You're showing the Message property of the unhandled exception. If you can get the Message property then you can get every other property too.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    Re: Ahhh!! major problem.

    Alright figured it out.
    PRETTY MUCH on my development PC the SQL server name was "SQLEXPRESS" which i think is default.
    the fact that my laptop came with sql server express with a DIFFERENT name was the problem. I tried setting up an alias but failed. Then I proceeded to uninstalling the SQL server and reinstalling it with the correct name.


    everything is good now

    I was actually wondering before i mark this as resolved, is there a way to make it connect to any server name? I know in my connection string its hard coded (the way VS made it), so is tehre a way i can soft code it?

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Ahhh!! major problem.

    When you create a Data Source you're prompted to store the connection string in the config file. If you do that then you can edit the config file, either by hand or programmatically, to point to a different database. I've never actually tried to do that but it may be that your app will pick up the new connection string automatically from the config file the next time it's run.

    If it can't be picked up automatically you can set it programmatically. In the DataSet designer you can set the ConnectionModifier property of your TableAdapters to Public. They will all then expose a public Connection property, which returns the underlying SqlConnection object. You can then set the ConnectionString property of that SqlConnection. Note that that must be done for each new TableAdapter object you create.

    Note that if you're going to build a UI to have the user enter the connection settings you should build it on top of SMO and an SqlConnectionStringBuilder. It's then quite easy to create a UI similar to that provided by VS to connect to SQL Server.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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