"MDAC required" but it's installed...

D

DraguVaso

Ok, today's I tested it: it worked once, than it didn't work anymore.

After that I made a small Test-appliation to test the conenction: I make my
connection etc the same way as in my application, and it works all the
time!!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strConn As String
strConn = "Server=BESQL1;DataBase=VocalcomCetelem;User
ID=vocalcomcetelem;Password=vocalcomcetelem;Trusted_Connection=False"

Dim strSql As String
strSql = "SELECT TOP 1 * " & _
"FROM tblCalls " & _
"ORDER BY CallID DESC"

Dim dtrSql As SqlDataReader
Dim conSql As SqlConnection
conSql = New SqlConnection(strConn)
Dim cmdSql As SqlCommand
Try
conSql.Open()
cmdSql = New SqlCommand(strSql, conSql)
dtrSql = cmdSql.ExecuteReader(CommandBehavior.SingleRow)
dtrSql.Read()
If dtrSql.HasRows Then
MessageBox.Show(dtrSql.Item("tdcaNCartphy").ToString)
End If
Catch ex As Exception
MessageBox.Show(ex.Message & ex.StackTrace)
End Try

End Sub


Afterwurths I did some more tests with my application: on one pc it still
didn't work, on the other miraculously it worked 6-7 times one after the
other without error!! I really can't get it why it works sometimes and other
times it doesn't.

Are there 'better' ways to open the connection? Maybe I should make my query
on another way so it doesn't need to open the connection like this? Or I
don't know how?

Thanks, Pieter
 
S

scorpion53061

After that I made a small Test-appliation to test the conenction: I make
my
connection etc the same way as in my application, and it works all the
time!!

connection issue just like I had said!! :)
 
D

DraguVaso

I made a small test-application, and that works all the time (tested it
20-30 times), but the 'real' application works like 20% of the time.

My test-application:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strConn As String
strConn = "Server=BESQL1;DataBase=VocalcomCetelem;User
ID=vocalcomcetelem;Password=vocalcomcetelem;Trusted_Connection=False"

Dim strSql As String
strSql = "SELECT TOP 1 * " & _
"FROM tblCalls " & _
"ORDER BY CallID DESC"

Dim dtrSql As SqlDataReader
Dim conSql As SqlConnection
conSql = New SqlConnection(strConn)
Dim cmdSql As SqlCommand
Try
conSql.Open()
cmdSql = New SqlCommand(strSql, conSql)
dtrSql = cmdSql.ExecuteReader(CommandBehavior.SingleRow)
dtrSql.Read()
If dtrSql.HasRows Then
MessageBox.Show(dtrSql.Item("tdcaNCartphy").ToString)
End If
Catch ex As Exception
MessageBox.Show(ex.Message & ex.StackTrace)
End Try

End Sub


The error's:
Like this with MDAC 2.7 installed:
The .Net Data SQL Provider (System.Data.SqlClient) requires Microsoft Data
Access Components(MDAC) version 2.6 or later.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
Or this with MDAC 2.8:
Object reference not set to an instance of an object.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()


Any idea? :-(
 
L

Leo Muller

Hi,

Obviously the connection has problems, that's why it can't open it, and in
your "finally" part it can't close it either, since it wasn't opened.

I think you can isolate the problem by just creating the connection, open
and close it. The same will happen then.

If the connection does work sometimes, then there isn't anything wrong with
your application, or MDAC. Rather you may be experiencing a network problem,
or a SQL problem.

use try and catch while opening the connection, and check the error
description and source that it will return.

Leo
 
D

DraguVaso

Ok I finally found out what caused the problem: Fasten your seatbelts:
The EXTRA.System-object conflcited with the SetWindowsHookEx-function. Both
of them worked fine, and there wasn't anything to see at it. But they caused
sometimes an error on the Database-Connection...

Disabling these functions on NT (and now finding an other solution for that
part) fixed the problem.

Thanks a lot to averything who helped me looking for a solution.

Pieter
 
D

DraguVaso

Hehe thanks :)

I hope if I'll ever have children they won't be such a pain in the ass :)

Although, one advantage children have above software is that you can beat
them up ;-)
 
P

Patrick Yan

Hi, I also have just started to experience the MDAC required messages even
though I installed 2.7 and then 2.8.

My situation is a bit different though. I was developing on a Windows 2000
Server machine with Visual Studio .Net 2002 and then I upgraded the OS to
Windows Server 2003 and that's when I started to get the error messages.

I can connect using the OracleClient Connection objects but not the
Oledb.Connection objects?

Is there something special I have to do with Windows Server 2003.

Thanks,
Patrick
 
D

DraguVaso

Hm I wouldn't know: I got the problem only on Windows NT, and because of a
WindowsKeyHook and a Extra-Session object that conflicted...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top