I have this code that works very well in different languages but when I change the regional setting number format to "Chinese Traditional" Out of memory exception happens on Executereader! What to do? Thank you!
Dim dv As DataView
Dim dt As DataTable = New DataTable
dv = New DataView(dt)
Dim dr As DataRow
Dim myreader As OleDbDataReader
dbobj = New dboperation("2")
dbobj.objcmd.CommandType = CommandType.Text
dbobj.objcmd.CommandText = "SELECT [geonameid], [name], [asciiname], [alternatenames], [latitude], [longitude], [timezone], [admin1 code], [code] , [Field2], [Field3] FROM atlas_view a left join Admin1CodesASCII d on a.code=d.Field1 WHERE (@Country Is NULL OR [country code]=@Country) and (@City Is NULL OR [alternatenames] like '%'+@City+'%')" ' OR [Alt] like '%'+@City+'%')"
dbobj.objcmd.Parameters.AddWithValue("@Country", IIf(Country = "" Or Country Is Nothing, DBNull.Value, mMdl.FixString(Country)))
dbobj.objcmd.Parameters.AddWithValue("@City", IIf(City = "" Or City Is Nothing, DBNull.Value, City))
If mMdl.SQlInjection(dbobj) Then
Return Nothing
End If
If dbobj.objcmd.Connection.State = ConnectionState.Closed Then
dbobj.objcmd.Connection.Open()
End If
myreader = dbobj.objcmd.ExecuteReader
This isn't a direct answer, but I wanted to address several concerns in the original code and needed more space than would fit in a comment. Some of the changes are stylistic, but a few of these changes fix actual serious bugs in the original code. It also amazes me how often just fixing these kinds of things to use better patterns will fix the original issue in a question.