Home
About
Contact
Categories
Classic ASP (32 - Entries)
CSS (1 - Entry)
JavaScript (5 - Entries)
Databases (30 - Entries)
ASP.NET (26 - Entries)
Delphi (6 - Entries)
Windows Server Core (13 - Entries)
VMWare (1 - Entry)
Code Editing Tools (2 - Entries)
Linux (4 - Entries)
Dell Servers (15 - Entries)
Design and Editing Software (1 - Entry)
Blog Entries
2025 (3 - Entries)
Bug Reports
(Bugs Fixed
CFFCS Coding Source
Please report any errors to the [
Contact
] page. Thank you.
Classic ASP (32)
CSS (1)
JavaScript (5)
Databases (30)
ASP.NET (26)
Delphi (6)
Windows Server Core (13)
VMWare (1)
Code Editing Tools (2)
Linux (4)
Dell Servers (15)
Design and Editing Software (1)
Tools
Format Your SQL Script
Minify your CSS
Resources
[View The Source Code For This Project]
ASP.NET
VB.NET
ASP.NET (VB Version) Database Driven Select Menu (Dropdown Menu)
Live Editing Disabled for Server-Side Example
HTML
Load.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Load.aspx.vb" Inherits="Load" %>
ASP.NET (VB Version) SQL Server Database Driven Dropdown Menu
This demonstration populates a Select Menu with values from a database table.
SQL
XDropDown
-- Create a new database called [Virtual-Class-01] in SQL Server. -- Right-click and choose [New Query] -- Copy and paste the code below and hit [Execute] USE [Virtual-Class-01] GO /****** Object: Table [dbo].[DropDown] Script Date: 7/31/2022 5:57:27 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[DropDown]( [ddID] [int] IDENTITY(1,1) NOT NULL, [ddName] [nvarchar](50) NOT NULL, CONSTRAINT [PK_DropDown] PRIMARY KEY CLUSTERED ( [ddID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET IDENTITY_INSERT [dbo].[DropDown] ON GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (1, N'asp classic') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (2, N'visual basic') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (3, N'jquery') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (4, N'javascript') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (5, N'asp.net') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (6, N'vb.net') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (7, N'C#') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (8, N'web.config') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (9, N'database.config') GO INSERT [dbo].[DropDown] ([ddID], [ddName]) VALUES (10, N'runtime') GO SET IDENTITY_INSERT [dbo].[DropDown] OFF GO
ASP.NET
web.config
database.config
Load.aspx.vb
Imports System.Data Imports System.Configuration Imports System.Data.SqlClient Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Me.IsPostBack Then Dim constr As String = ConfigurationManager.ConnectionStrings("Virtual-Learning").ConnectionString Using con As New SqlConnection(constr) Using cmd As New SqlCommand("SELECT ddId, ddName FROM Dropdown") cmd.CommandType = CommandType.Text cmd.Connection = con con.Open() DropDownList1.DataSource = cmd.ExecuteReader() DropDownList1.DataTextField = "ddName" DropDownList1.DataValueField = "ddId" DropDownList1.DataBind() con.Close() End Using End Using DropDownList1.Items.Insert(0, New ListItem("--Select Programming Language--", "0")) End If End Sub
Preview
Tags
dropdown menu with SQL Server
dropdown menu with SQL Server
dropdown menu with SQL Server
Create a connection to our database
Create a connection to our database
Create a connection to our database
populate our select menu
populate our select menu
populate our select menu
close the RecordSet
close the RecordSet
close the RecordSet
ASP.NET VB database-driven dropdown menu
vb.net database-driven dropdown menu
close database connection in vb.net