|
|
Sponsor |
RE: Huge memory consumed with myOdbc and VB.NET: msg#00004db.mysql.odbc
> Vb-code: Please send code per attachment - mailers tend to mangle it. Alternatively keep it below 80 characters or use a mailer that supports format=flowed. > Imports System.Data.Odbc > Module Module1 > Private conn As OdbcConnection > Private adapter As OdbcDataAdapter > Sub Main() > Dim ds As New DataSet > Dim sql As String > Dim count As Integer = 10000 > conn = New OdbcConnection("DSN=test") > sql = "SELECT * FROM xxx where id='1'" > Try > conn.Open() > adapter = New OdbcDataAdapter(sql, conn) > adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey > ' When removing above line the issue doesn't arise! > Catch ex As Exception > Console.WriteLine(ex.Message) > Console.ReadLine() > End > End Try Your try..catch structure looks weird. Below, you actually attempt to fill the dataadapter whether you successfully connect to the database or not. Is this intentional? > Do > Try > adapter.Fill(ds, "table") You're filling into a table named "table"... > Catch ex As Exception > Console.WriteLine("Count: {0}\r\n{1}", count, ex.Message) > ' "Object reference not set to an instance of an object" > ' after about 500 queries > Exit Do > End Try > ' Do some work! > If Count Mod 100 = 0 Then > Console.Write("{0}, ({1})",Count,ds.Tables(0).Rows.Count) > End If > ds.Tables("xxx").Clear() You're trying to delete a table that does not exist. You've explicitly named the table "table" earlier, so you'll get a null reference exception here in the first execution of your loop. Also, could you please post your database schema (SHOW CREATE TABLE xxx)? The definition of primary keys will have an effect on which code path your test case follows. You mention that you use "id" as a primary key, but is it actually defined as such in your database? > Count -= 1 > Loop Until Count <= 0 > End Sub > End Module -- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@xxxxxxxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Huge memory consumed with myOdbc and VB.NET, Patrik Lindvall |
|---|---|
| Next by Date: | SV: Huge memory consumed with myOdbc and VB.NET, Patrik Lindvall |
| Previous by Thread: | Huge memory consumed with myOdbc and VB.NET, Patrik Lindvall |
| Next by Thread: | SV: Huge memory consumed with myOdbc and VB.NET, Patrik Lindvall |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|