We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,524 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

adapter.fill takes too long to execute

Dim Con As OdbcConnection = New OdbcConnection
        query = "Select Part_No,SLNOINPART,House_No,SurName+ ' '+F_Name+ ' '+M_Name As Name,Sex,Age,LocalityId from datafile where (Part_No between " & txtPartFrom.Text & " and " & txtPartTo.Text & ") and (age between " & txtAgeFrom.Text & " and " & txtAgeTo.Text & ") order by Part_No"

        Con.ConnectionString = connstring
        Dim da As OdbcDataAdapter = New OdbcDataAdapter(query, Con)
        da.Fill(ds, "Agegroup")
        If ds.Tables("Agegroup").Rows.Count = 0 Then
            MsgBox("No records found.")
        Else
            dgvAgeGroupDetails.DataSource = ds.Tables("Agegroup")

Da.fill(ds,"Agegroup") takes too long to execute.I tried the sql query in access,it executes in 2-3 secs but here in vb.net ,it takes 2-3 mins.Does any1 know the reason behind this?Please help me.

2
Contributors
2
Replies
3 Days
Discussion Span
4 Months Ago
Last Updated
3
Views
Rachna0309
Light Poster
36 posts since Nov 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Are you retreiving a large amount of records?

Begginnerdev
Practically a Posting Shark
864 posts since Apr 2010
Reputation Points: 184
Solved Threads: 142
Skill Endorsements: 8

Solution is: In where clause of query,the fields that are used should be indexed so that searching can be done faster.

Rachna0309
Light Poster
36 posts since Nov 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.3372 seconds using 2.68MB