|
-
Sep 5th, 2009, 05:47 PM
#1
Thread Starter
Member
Problem with Database app slowing down
Hello Everyone,
I am having an issue I don't know how to resolve. I am querying a database and making updates as I go along. when I first start the application it runs so fast but after about 5-10 minutes it starts to slow down to a snail's crawl. it's horrible. anyone have any suggestions as to how to prevent this?
This is a snippet of code:
m_daDataAdapter = New OleDb.OleDbDataAdapter("Select * From Word_Verse where Word = '" & MakeSQLSafe(strWord) & "' and VersePart = '" & MakeSQLSafe(strTempVerse) & "' and Book = '" & strBook & "'", m_cnADONetConnection)
m_cbCommandBuilder = New OleDb.OleDbCommandBuilder(m_daDataAdapter)
m_dtWordVerse.Reset()
m_daDataAdapter.Fill(m_dtWordVerse)
Where it's getting stuck or slowing down each time is on this line:
m_daDataAdapter.Fill(m_dtWordVerse)
I've tried resetting it but that didn't help I'm not sure what the issue is.
Any help would be great.
Thank you
Mythos
-
Sep 5th, 2009, 06:17 PM
#2
Re: Problem with Database app slowing down
Are you doing all this in a loop?
you should not fill the data adapter in the loop.. Instead fill it once, make your changes and finally call the update method when you are thru with everything to finalize it to the database.
-
Sep 5th, 2009, 06:26 PM
#3
Thread Starter
Member
Re: Problem with Database app slowing down
Yes, I'm doing this in a loop. The reason is that I'm cycling through every word in a text file to index them in a database.
The file is the King James bible so that I can create a search application.
now I think I may have resolved my issue. Instead of creating my data table as a global variable I dimed it as a local variable and then after it updates each record I set the variable back to nothing and that seems to have resolved the issue and it's just cruising along now.
Thanks again for your help.
Mythos
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|