|
-
December 10th, 2010, 11:29 AM
#1
[RESOLVED] SQL Connection testing
hey guys,
i have been working on making this C-Sharp application and it invloves connecting to an SQL Database. is there a way for me to test that the connection has been established? or do i have to just hope it does get connected?
thanks in advance
-
December 10th, 2010, 03:14 PM
#2
Re: SQL Connection testing
I'm not sure if I understand... but can't you just run the application?
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 10th, 2010, 04:28 PM
#3
Re: SQL Connection testing
well i run the application, but until i dont seem to be able to get data sent to the database.. and when i do run the application, it crashes if the button used for submiting data is doing something wrong. generally if it doesnt crash i assume that it is a valid connection but i want to know if i can like run a if statement that will test for the connection(meaning the connection is true or false) and then if it is true i put my data on the database and if it is false i give an error
-
December 10th, 2010, 05:02 PM
#4
Re: SQL Connection testing
On developing a db application on my development machine I have NEVER had a database connection attempt go wrong with a good valid connection string/connection code. Once the good code is in place a connection can go wrong for a few reasons when the application is live.
Also as a side note whenever I do an app I purposely don't code any try catch blocks in the beginning so that I can see what exactly is causing the app to crash and more easily see the mistakes I was making. Once I pretty much think I have the code as error free as possible (within reason) I code the try catch blocks.
If you step through your code you should see that most likely your problem is not whether you are connected or not. If you got it right at some point then you probably have it right all the time.
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
|