开发者

how can I check if a tsqlconnection is open?

after an unsuccesfull login:

mytsqlconnection->Open();
if(mytsqlconnection->ConnectionState == cs开发者_JS百科StateOpen)
{
 ...
}

the "if" returns true. How can I check if the connection is really open? Do I have to execute a query and catch the exception? Thanks in advance.

Francesco


If the login fails, Open() should be raising an exception. The ConnectionState property is not set to csStateOpen unless Open() is successful in establishing a connection to the DB without error.


It was a matter of driver. I used the dbexpora.dll that came with cppbuilder6 (right-click on dbexpora.dll give no info about version). I change driver and everything works fine: Open() raise the exception, ConnectionState is set as expected. Thankyou.

Francesco

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜