Tuesday, March 27, 2012

@@ERROR per connection?

Hi
Hoping someone may know this. I am connecting to sql server via
OleDbConnection from C#.
Is the instance of @.@.ERROR that is set in db per connection? What I
was going to do was, after connecting and opening a data reader on one
connection, I wanted to open a 2nd connection and read @.@.ERROR.
But every time I read @.@.ERROR, it is 0, regardlessof the previous
read.
I suspect this is because conenction 2 is not reading the @.@.ERROR set
by connection1.
Is this the case?
Thanks
Jeff"Jeff User" <jeff31162@.hotmail.com> wrote in message
news:6o3ap198n6vs7kb14h80maab9rgd9mfelg@.
4ax.com...
> Hi
> Hoping someone may know this. I am connecting to sql server via
> OleDbConnection from C#.
> Is the instance of @.@.ERROR that is set in db per connection? What I
> was going to do was, after connecting and opening a data reader on one
> connection, I wanted to open a 2nd connection and read @.@.ERROR.
> But every time I read @.@.ERROR, it is 0, regardlessof the previous
> read.
> I suspect this is because conenction 2 is not reading the @.@.ERROR set
> by connection1.
> Is this the case?
Correct. Any time you get an error it propagates back to the client. For
you it will become an OleDbException. BTW why OleDbConnection and not
SqlConnection?
David|||Thanks David
I used OleDb because I read that it was more verstile and my code will
eventually be ported to other databases. Is this incorrect?
Thanks
Jeff
On Mon, 5 Dec 2005 22:34:07 -0600, "David Browne" <davidbaxterbrowne
no potted meat@.hotmail.com> wrote:

>"Jeff User" <jeff31162@.hotmail.com> wrote in message
> news:6o3ap198n6vs7kb14h80maab9rgd9mfelg@.
4ax.com...
>Correct. Any time you get an error it propagates back to the client. For
>you it will become an OleDbException. BTW why OleDbConnection and not
>SqlConnection?
>David
>|||Hmm, do I even need to try to read the SQL server @.@.error or will I
always get the same information in my oleDb error that is raised when
there is a failure?
Thanks again
Jeff
On Mon, 5 Dec 2005 22:34:07 -0600, "David Browne" <davidbaxterbrowne
no potted meat@.hotmail.com> wrote:

>"Jeff User" <jeff31162@.hotmail.com> wrote in message
> news:6o3ap198n6vs7kb14h80maab9rgd9mfelg@.
4ax.com...
>Correct. Any time you get an error it propagates back to the client. For
>you it will become an OleDbException. BTW why OleDbConnection and not
>SqlConnection?
>David
>|||"Jeff User" <jeff31162@.hotmail.com> wrote in message
news:486ap1ppcjptrckbde41oekh84e2srj163@.
4ax.com...
> Hmm, do I even need to try to read the SQL server @.@.error or will I
> always get the same information in my oleDb error that is raised when
> there is a failure?
That's an OleDB implementation detail I don't know. With the SqlClient, the
Error number and message are available.
David|||"Jeff User" <jeff31162@.hotmail.com> wrote in message
news:746ap1dmf2hgclqarvfe2gd219dbajcfvk@.
4ax.com...
> Thanks David
> I used OleDb because I read that it was more verstile and my code will
> eventually be ported to other databases. Is this incorrect?
That's one way. But probably not the preferred way. It isolates the
differences between databases out to a layer you have very little access to,
and forces you to use COM interop in your code. All the .NET data providers
implement a set of common interfaces, so you can support multiple databases
and still use the best client library for each one.
See:
Generic Coding with the ADO.NET 2.0 Base Classes and Factories
http://msdn.microsoft.com/library/d...r />
erics.asp
Data Access Application Block for ADO.NET 1.1
http://msdn.microsoft.com/practices...2/html/daab.asp
David|||OK, I can do some research/testing on this one.
Thanks for both replies and I will look into the sqlClient and check
out the articles.
jeff
On Mon, 5 Dec 2005 23:53:35 -0600, "David Browne" <davidbaxterbrowne
no potted meat@.hotmail.com> wrote:

>"Jeff User" <jeff31162@.hotmail.com> wrote in message
> news:486ap1ppcjptrckbde41oekh84e2srj163@.
4ax.com...
>That's an OleDB implementation detail I don't know. With the SqlClient, th
e
>Error number and message are available.
>David
>

No comments:

Post a Comment