Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7781251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:10:03+00:00 2026-06-01T19:10:03+00:00

Solution 1: Dim i As Integer = CInt(_table.Rows(0).Item(3)) Do While i – 2 >

  • 0

Solution 1:

Dim i As Integer = CInt(_table.Rows(0).Item(3))
Do While i - 2 > 0
                _tableBackLogs.Merge(Global.DataAccess.GetDataTable("SELECT SubjectID,SubjectName,Grade FROM SubjectPI WHERE RegNo='" & CInt(HttpContext.Current.Session("userName")) & "' AND Status='Fail' AND Semester='" & i - 2 & "'"))
                i = i - 2
            Loop

Solutin 2:

 If i = 1 Then
                Global.DataAccess.GetDataTable("SELECT SubjectID,SubjectName,Grade FROM SubjectPI WHERE RegNo='" & CInt(HttpContext.Current.Session("userName")) & "' AND Status='Fail' AND Semester='" & i & "'")
            ElseIf i = 2 Then
                Global.DataAccess.GetDataTable("SELECT SubjectID,SubjectName,Grade FROM SubjectPI WHERE RegNo='" & CInt(HttpContext.Current.Session("userName")) & "' AND Status='Fail' AND Semester='" & i - 2 & "'")
            ElseIf i = 3 Then
                Global.DataAccess.GetDataTable("SELECT SubjectID,SubjectName,Grade FROM SubjectPI WHERE RegNo='" & CInt(HttpContext.Current.Session("userName")) & "' AND Status='Fail' AND Semester='" & i - 2 & "'")
                'On and on....upto i=8
            End If

Which one is a better solution in terms of performance and speed of execution??

UPDATE: I am storing the data into a DATATABLE….and then using it with a ListView.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:10:04+00:00Added an answer on June 1, 2026 at 7:10 pm
    Which one is a better solution in terms of performance and speed of execution??
    

    Well, putting aside the concern about string concatenation, the best approach will be to get all the data needed in the minimum number of calls to the database.

    You should change your code to identify which semesters are needed and then put everything together in an unique query.
    So, as you said, in your comment, (Semester=1 OR Semester=2 OR Semester=3") would be better.

    From your code, I assume that semester is a varchar field. That’s bad because, if it was a number, you could write a better query using minimum and maximum values. (Also if you can assure that semesters are in consecutive order.). (Semester >= 1 AND Semester <= 3)

    However, the best performance you can get out of this, is if in your datatable has the correct indexes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the following LINQ Statement: Dim PSNum As Integer = 66 Dim InvSeq
Hi everybody: Following liitle issue: Option Base 1 Sub Test() Dim aa() As Integer
I've the following function defined in Excel: Function LongString() Dim i As Integer Do
Solution: if you have the same problem, addElement() instead of addChild() is what did
Solution: strpos turned out to be the most efficient. Can be done with substr
Solution is called Portal which holds Areas/CMS/Login folder inside it. Login controller in CMS/Controllers
Solution: I had also moved ashx and asmx files at the same time as
Solution Edit: Turns out you can't use the PHP SDK to return the correct
Edited: SOLUTION FOUND. This is strange and not the best solution, but I just
The solution to a previous question ( How to implement Maintenance Mode on already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.