DraguVaso
Wed Jun 02 04:17:14 CDT 2004
Ok, today's news: 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
"scorpion53061" <scorpion_53061@nospamhereeveryahoo.com> wrote in message
news:utNIzo%23REHA.1256@TK2MSFTNGP09.phx.gbl...
> This error normally occurs when a connection cannot be established with
the
> server.
>
> Create a new project (do not use anything from this current project you
are
> in) and attempt to create a connection there. Don't get fancy.
>
> If this does not work, copy and paste here the code you are using.
>
> If this does not work then
>
> 1. reinstall Jet
> 2. reinstall the Framework
> 3. Reinstall MDAC 2.8
>
> If this does not work reinstall Windows. Others may disagree with me but
> trying all this if it fails it is clear the corrpution is in your
operating
> environment.
>
> "DraguVaso" <pietercoucke@hotmail.com> wrote in message
> news:urgk6e%23REHA.3628@TK2MSFTNGP12.phx.gbl...
> > I tryed that, but it didn't work: the error becomes now:
> > 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()
> >
> > "scorpion53061" <scorpion_53061@nospamhereeveryahoo.com> wrote in
message
> > news:u5tHsY%23REHA.3988@tk2msftngp13.phx.gbl...
> > > reinstall jet.
> > >
> > >
> >
>
http://www.microsoft.com/downloads/details.aspx?FamilyID=4335216C-8CDD-4168-A030-46F815D3F5CD&displaylang=en
> > >
> > > It is time. Then reinstall MDAC 2.8.
> > >
> > >
> >
> >
>
>