Ask a Question related to ASP, Design and Development.
-
djharrison #1
dropdown list and database connection
I'm new to ASP and database programming but I am trying to connect to
a database using a concatenation of a strings and a menu item from a
form.
Ok here's what I have... an asp form that has a dropdown menu list
that finds *.mdb files in the current folder. It also has a 'Select'
button on it. I want the user click select and either in this page or
another (not sure which is best?) make a connection to the database
using the strPath string and the name of item choosen from the
dropdown menu. Here's my code. Any help is appreciated. Thanks.
<%
Dim strPath
strPath = "D:\My Web\LBSAR\myDBAdmin\"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPath)
'Find Number of Files
varFileCount = 0
For Each objFile in objFolder.Files
varFileCount = varFileCount + 1
Next
' Put File Names into an Array
ReDim varFileNames(varFileCount)
n = 0
For Each objFile in objFolder.Files
n = n + 1
varFileName = objFSO.GetFileName(objFile.Name)
varFileType = objFSO.GetExtensionName(objFile.Name)
If (Left(varFileType, 3) = "mdb") Then
varFileNames(n) = objFile.Name
End If
Next
Set objFolder = Nothing
Set objFile = Nothing
Set objFSO = Nothing
%> <select name="database">
<option value=".">Please Select a Database</option>
<% For n = 1 To VarFileCount %>
<option value="<%=varFileNames(n)%>" >
<%=varFileNames(n)%></option>
<% Next %>
</select>
<input type="button" value="submit" class="button">
Thanks
Daryl
djharrison Guest
-
Dropdown list
I would like to display 15 items (lines) in the dropdown list, but by default the list displays only 11 lines. How can I have all the 15 items... -
Refresh dropdown list
On a cfform I have a cfselect dropdown . The situtation is that when an option isn't listed I have a "Add button" next to the drop down that... -
Tool Tip for DropDown list
Hi, I have a dropwnlist of fixed width. The item names in the dropdown list are quite big. The Tooltip property for a dropdownlist control... -
Write contents of Dropdown list to a database
i am dynmically creating a dropdown list and i am wondering how to write the contents of the dropdown list to a database. Purpose: i am creating... -
Write entire contents of dropdown list to a database
i am dynmically creating a dropdown list and i am wondering how to write the contents of the dropdown list to a database. Purpose: i am creating... -
Ken Schaefer #2
Re: dropdown list and database connection
You need to get the user to submit the information back to the server.
THen you can access Request.Form("database") to see what the user selected.
Cheers
Ken
"djharrison" <daryljharrison@netscape.net> wrote in message
news:75e82834.0309242244.de11521@posting.google.co m...
: I'm new to ASP and database programming but I am trying to connect to
: a database using a concatenation of a strings and a menu item from a
: form.
: Ok here's what I have... an asp form that has a dropdown menu list
: that finds *.mdb files in the current folder. It also has a 'Select'
: button on it. I want the user click select and either in this page or
: another (not sure which is best?) make a connection to the database
: using the strPath string and the name of item choosen from the
: dropdown menu. Here's my code. Any help is appreciated. Thanks.
:
: <%
: Dim strPath
: strPath = "D:\My Web\LBSAR\myDBAdmin\"
:
: Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
: Set objFolder = objFSO.GetFolder(strPath)
:
: 'Find Number of Files
: varFileCount = 0
: For Each objFile in objFolder.Files
: varFileCount = varFileCount + 1
: Next
:
: ' Put File Names into an Array
: ReDim varFileNames(varFileCount)
: n = 0
:
: For Each objFile in objFolder.Files
: n = n + 1
:
: varFileName = objFSO.GetFileName(objFile.Name)
: varFileType = objFSO.GetExtensionName(objFile.Name)
: If (Left(varFileType, 3) = "mdb") Then
:
: varFileNames(n) = objFile.Name
: End If
: Next
:
: Set objFolder = Nothing
: Set objFile = Nothing
: Set objFSO = Nothing
: %> <select name="database">
: <option value=".">Please Select a Database</option>
: <% For n = 1 To VarFileCount %>
: <option value="<%=varFileNames(n)%>" >
: <%=varFileNames(n)%></option>
: <% Next %>
: </select>
: <input type="button" value="submit" class="button">
:
: Thanks
:
: Daryl
Ken Schaefer Guest



Reply With Quote

