Last post Jun 10, 2011 02:56 PM by Drew B
Jun 10, 2011 12:38 PM|Drew B|LINK
Hi all, very very new to asp.net and access programming, so please bear with me if this is a really dumb question.
I currently have a database with around 700 items that is not displaying on the site in correct sorting order. It does the whole 113 after 11 but before 12 type thing. So my idea was to just add a leading zero to the proper field to solve the problem.
Which it does. The new problem is my boss hates it. While it organizes correctly now, the leading zero cannot be displayed on the site.
Response.write(objReader.GetString(0) + " " + objReader.GetString(2) + "<br>")
is the code I'm using to display the correct item number (the value in (0) is not really applicable to this issue, but I felt being complete with my code would help). So is there a way I can rewrite my line of code to get rid of any leading zeroes in the
access file but still use them for the purpose of sorting on the site?
Jun 10, 2011 01:15 PM|Jeev|LINK
objReader.GetString(2).substring(1) // assuming you added one leading zero here we remove that
Jun 10, 2011 02:56 PM|Drew B|LINK
First, thanks for the speedy reply. Unfortunately that did not work. Or rather it did, but I neglected to mention that the field causing the problem is a combination of letter and numbers. Based on the result received, I'm guessing that causes an issue.
Just to help make sure there is no confusion going forward, I'll tell you exactly what i have. I have a field called series (e.g. C009) and a field called DSeries (e.g. C9). DSeries is the display field that gets shown on the website while series is the
one with the leading zeroes. The line of code you suggested caused the result of the webpage to display the items properly sorted (hooray!) but without the letter (booo). Is there a way i can further modify this code to achieve the intended result?
*edit* - so..strangely enough, I went back to the asp file and removed the substring command and lo and behold, everything works properly now. Now I'm not sure why this is happening, but I think it's best not to ask too many questions when things works
I'll leave this post up in case someone else feels like figuring out how to add the letter back in while using a subString function.
Again, thanks for the help!