Re: .Read() causes "Connection unexpectedly terminated" [EASY WAY TO CODE]
Posted by: Emanuel Oliveira
Date: February 24, 2006 04:29PM

Hi,

I also had nightmares trying to use the .NET connector 1.04 and 1.07 with a datareader.. i just forget it, i keep getting lot's of intermitent errors.. like "no data to read", "host unexpectly closed connection", and things like this.

So, the perfect solution for most of our 90% needs, is as simple as to use the mySqlHelper ready-simple-to-use method executeDataset, as follows:

'-- SQL --
Dim myData as System.Data.DataSet= mySqlHelper.ExecuteDataset(myConnString,mySqlString)

'-- get number of records
Dim iNumResults as Integer = myData.Tables(0).Rows.count

'-- access columns
Dim myValue as string = myData.Tables(0).Rows(0)("some-db-field-name")

Now, I can add this (after sharing my above cool knowledge), is that I just posted that we are not able to get any exception from the mySqlHelper class unless it seems... we have a SQL syntax error in our mySqlString. Give it a try, now that my above ideas solve your problem :) try now to solve mine :)

Cheers~
Emanuel



Edited 2 time(s). Last edit at 05/17/2006 04:36AM by Emanuel Oliveira.

Options: ReplyQuote


Subject
Written By
Posted
Re: .Read() causes "Connection unexpectedly terminated" [EASY WAY TO CODE]
February 24, 2006 04:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.