|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GetOrdinal problemSorry for the cross post first of all. I posted to the ADO forum the first time by accident. I wrote a windows service in c# .net 2.0. There is a timer that fires every second or so and when it does I start two threads (unless they are still running from the last time). One of the threads queries SQL server using a data reader. Every once in a while I get a runtime related to GetOrdinal. Here is the call stack: at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName) at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) at GTS.ComAppLibrary.LXRecord.ReadRecords(SqlDataReader _dr) I googled for this and I did find one posting on MSDN that goes back to Nov of 2005. A number of people have had a similar problem, but nobody seems to have a good solution. Unfortunately I have just used a work around of supplying integers to the GetString (and other get methods). Is there a fix for this problem? Has MS been able to reproduce the problem? Thanks Randy I don't think you can assume (in your case) that the resultset contains the
(a ?) rowset you expect. Are you dealing with the HasRows = False case? -- Show quote____________________________________ William (Bill) Vaughn Author, Mentor, Consultant Microsoft MVP INETA Speaker www.betav.com/blog/billva www.betav.com Please reply only to the newsgroup so that others can benefit. This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________ Visit www.hitchhikerguides.net to get more information on my latest book: Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition) and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ----------------------------------------------------------------------------------------------------------------------- "Dandle" <no@spam.com> wrote in message news:MPG.2051f571bbcea7b0989681@news.supernews.com... > Hi, > > Sorry for the cross post first of all. I posted to the ADO forum the > first time by accident. > > > I wrote a windows service in c# .net 2.0. There is a timer that fires > every second or so and when it does I start two threads (unless they are > still running from the last time). > > One of the threads queries SQL server using a data reader. Every once > in a while I get a runtime related to GetOrdinal. Here is the call > stack: > > at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String > fieldName) > at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) > at GTS.ComAppLibrary.LXRecord.ReadRecords(SqlDataReader _dr) > > > I googled for this and I did find one posting on MSDN that goes back to > Nov of 2005. A number of people have had a similar problem, but nobody > seems to have a good solution. > > Unfortunately I have just used a work around of supplying integers to > the GetString (and other get methods). > > > Is there a fix for this problem? Has MS been able to reproduce the > problem? > > > Thanks > > Randy Hi,
Thanks for the response. I think I figured it out. The service had a timer that would fire that would do an update and a read on the database and then would also kick off another thread if it was time. I think there was a collision between both threads sharing the same connection. I could get the problem to occur while debugging by having a break point in the place where an execute sql was happening off of the main thread. If I hit the break point and then waited long enough for the thread to be kicked off that would also update and read data before resuming I would then get the error. Thanks Randy In article <e6FygzTXHHA.5***@TK2MSFTNGP03.phx.gbl>, billvaRemoveT***@nwlink.com says... Show quote > I don't think you can assume (in your case) that the resultset contains the > (a ?) rowset you expect. Are you dealing with the HasRows = False case? > > |
|||||||||||||||||||||||