Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Int32 GetOrdinal(System.String)

Author  Topic 

colingraham
Starting Member

1 Post

Posted - 2009-02-11 : 03:07:46
i have searched for days for a solution, there is not much out there.

I get a random "Int32 GetOrdinal(System.String)" error on my DataLayer page. It is random, when it happend, i can not generate this error on demand. I get about 50 of these per day. The site is busy, but the Connection pool is about 60. Even useing a try catch, does not seem to work, still get the error page.


Source: System.Data
Target site: Int32 GetOrdinal(System.String)
Message: Rec_ID


vb.net code:
' Create Instance of Connection and Command Object
_web_Connection = New SqlConnection(Globals.ConnectionString)
Dim myCommand As New SqlCommand("Get_Single_CatGroupByCatGrpID", _web_Connection)

' Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
myCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CatGrp_ID", SqlDbType.Int, 0, CatGroup_ID)).Value = CatGroup_ID
myCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Lang_ID", SqlDbType.Int, 0, Language_ID)).Value = Language_ID


' Execute the command
_web_Connection.Open()
Dim result As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

Dim _CatGrp As CategoryGroup = Nothing

If result.Read Then
_CatGrp = New CategoryGroup(Cint_isDBNull(result("Rec_ID")), Cint_isDBNull(result("Lang_ID")), Cint_isDBNull(result("Cat_ID")), Cstr_isDBNull(result("Cat_Name")), result("Grp_ID"), Cstr_isDBNull(result("Grp_Name")), Nothing, _
Cstr_isDBNull(result("Grp_Slogan")), Cstr_isDBNull(result("Grp_Descr")), Cstr_isDBNull(result("Grp_Picture")), _
Cint_isDBNull(result("Disp_Order")), result("Off_Line"), Cstr_isDBNull(("Color_Name")), Cstr_isDBNull(("Color1")), Cstr_isDBNull(result("Color2")), _
result("Created"), result("Created_By"), result("Updated"), result("Updated_By"))
End If

result.Close()
_web_Connection.Close()

' Return the datareader
Return _CatGrp

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-03 : 09:20:01
Which line is producing the error?
Also, what are the 0 for parameter creation? An INT has a length of 4 bytes.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-03-03 : 10:18:04
Is it possible that this SP (Get_Single_CatGroupByCatGrpID) has some control-of-control logic in it? Perhaps one of your expected named columns in the result set is (occasionally) not being returned.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -