Technical Insights: Azure, .NET, Dynamics 365 & EV Charging Architecture

Dynamic array in VB/VB.NET/ASP

Time to go back to old school ASP, I found that i need to create an array that contains a list of languages from a table in database. I would like to make this array length as many as the number of rows in language table. yes you can do it through keyword of ReDim and Preserve

     <%
                dim objLanguage
                dim languageCount
                dim languageArray()

                languageCount = 0

                set objLanguage = Server.CreateObject("ADODB.Recordset")
                objLanguage.ActiveConnection = MM_CTG_STRING
                objLanguage.Source = "SELECT * FROM Languages"
                objLanguage.CursorType = 0
                objLanguage.CursorLocation = 2
                objLanguage.LockType = 3
                objLanguage.Open()

                WHILE NOT objLanguage.EOF
                    response.Write("

") response.Write(objLanguage("Language")) response.Write("

") ReDim Preserve languageArray(languageCount) languageArray(languageCount) = objLanguage("LanguageID") languageCount = languageCount + 1 objLanguage.MoveNext() WEND objLanguage.Close() Set objLanguage = nothing %>

Previous

How to clear a gridview

Next

Get Selected Item with Gridview in ASP.NET

1 Comment

  1. VBNet is really awesome.

Leave a Reply to Legacy Modernization Cancel reply

Your email address will not be published. Required fields are marked *

Powered by WordPress & Theme by Anders Norén