|
-
Mar 17th, 2008, 05:12 PM
#1
Thread Starter
Fanatic Member
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)
-
Mar 17th, 2008, 05:20 PM
#2
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.
-
Mar 17th, 2008, 05:22 PM
#3
Thread Starter
Fanatic Member
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?
-
Mar 17th, 2008, 06:02 PM
#4
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.
-
Mar 17th, 2008, 09:44 PM
#5
Thread Starter
Fanatic Member
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?
-
Mar 17th, 2008, 10:28 PM
#6
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|