Hi guys,

I'm doing an application that works with an online mysql database.

Here is a sample of my code:

Dim adapter As New MySqlDataAdapter("select * from my_table order by code", "server=my_server;User Id=me;password=password;Persist Security Info=True;database=database")

Dim my_table = New DataTable

adapter.fillj(my_table)

On the last line, the application freezes until the DataTable is filled. I realized that it doesn't happen with a local database.

Is there a way to avoid this?

Recommended Answers

How many rows do you get back from the remote database?

Jump to Post

76 is not that many rows, you could try to add a LIMIT 1 to your query to see if there's an improvement. As you're connecting to a remote db, it might be that the connection is really slow - no idea on how to work around that.

Jump to Post

All 5 Replies

Member Avatar

How many rows do you get back from the remote database?

76 rows

Member Avatar

76 is not that many rows, you could try to add a LIMIT 1 to your query to see if there's an improvement. As you're connecting to a remote db, it might be that the connection is really slow - no idea on how to work around that.

Please for vb code use ~~~ vb .... ~~~ fenced code tags if you use quote comments, otherwise you can select the code block and hit TAB.

Maybe there is a lot of columns?
There is nothing special about your code, maybe there is really a lot of data. Try creating a new thread, and put this code to run on it, you UI will be free to run.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.