|
-
Sep 24th, 2007, 03:31 AM
#1
Thread Starter
New Member
[RESOLVED] Does any one know how to fix this adodc control problem?
Here is the problem:
I use Adodc control in vb6.0 to access sql server,everything works fine until when the network failed.
the code simply like this:
<pre>
On Error ErrHandle
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;user id=sa;password=123456;initial catalog=test;data source=192.168.1.23\SQLEXPRESS;Connect Timeout=30"
Adodc1.Recordset.Properties("prompt") = adPromptNever
Adodc1.RecordSource = "select *from admin"
Adodc1.Refresh
'other code
ErrHandle:
'do nothing
</pre>
when the code run to Adodc1.Refresh,it pop up an error dialog with message "[DBNETLIB][ConnectionOpen (Connect()).]SQL Server Not Exist or Access Denied"
It's normal that you can't access data base when the network is not working,but since my program is runing at the server host I don't want it to click the dialog all the time when it can't connect to sql server.
So is there some way that can avoid the error dialog? and let it goto ErrHandle Section
I have being run into this problem for several months, any advice would help.
thank you.
-
Sep 24th, 2007, 08:46 AM
#2
Re: Does any one know how to fix this adodc control problem?
Welcome to VBForums 
Situations like this is one reason (of many) that most programmers don't use bound controls, more can be found in the article Why is using bound controls a bad thing? from our Database Development FAQs/Tutorials (at the top of this forum).
What I (and others) would recommend you do is get rid of the ADODC, and use ADO code instead. You can find an explanation/example of how to do that in the ADO Tutorial link in my signature.
-
Sep 24th, 2007, 11:01 AM
#3
Thread Starter
New Member
Re: Does any one know how to fix this adodc control problem?
thanks si_the_geek,
I desided to use ADO code instead,and I had done a lot of coding test to recode the old program,I think i can manage it.
thanks again!
-
Sep 24th, 2007, 11:07 AM
#4
Re: Does any one know how to fix this adodc control problem?
Welcome to the forums. 
If you consider this resolved, you could help us out by pulling down the Thread Tools menu and clicking the Mark Thread Resolved menu item. That will let everyone know that you have your answer.
Thank you.
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
|