speed problem

  • Thread starter Thread starter dzemo
  • Start date Start date
D

dzemo

I have about 50000 records in table in SQL. Which is the fastes way to
display data on form. I had used DataReader & litview but it takes 20
seconds or more to populated data. Any suggestions?
thx
 
Hi,

How many of the 50000 records do you think the user is going to look
at?

Ken
 
August 7, 2004

You could use user input to query the database for only
certain items
or rows that have certain values in their columns. Your code could
look
something like this:

dim querystring as string
querystring = "SELECT * FROM DATABASE WHERE columnname='" & _
userinput & "'"

dim cmd as new Data.SqlClient.SqlCommand(querystring, connection)

dim reader as new data.sqlclient.sqldatareader
connection.open
reader = cmd.executereader
connection.close

You can then use the reader to create rows in your datagrid. Be very
careful of SQL Injection attacks!!!!!!!!!!! You might use regular
expressions
to check the user input. That then brings up the subject of
canonicalization
issues. Good luck!


Joseph
 
well it a list of a pacients in one hospital and i dont have any idea which
doctor is going to see of them. Maybe sat before a form to ask 3 letters of
last name or somethink like that. But generaly which is the fastes way to
read that much data and in which control to display them
 
Hi,

It would better to load the data on demand rather than listing 50000
records. When ever possible try using a stored procedure to get the data
because it is quicker.

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top