|
|
|
Dropdownlist - ทำอย่างไรคะจะเอาค่าที่คิวรี่จากฐานข้อมูลมาแสดง |
|
|
|
|
|
|
|
Code (ASP)
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP & DropDownList From Database</title>
</head>
<body>
<%
Dim Conn,strSQL,objRec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
strSQL = "SELECT * FROM customer "
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open strSQL, Conn, 1,3
%>
<select name="select">
<option value="<!--- Select -->">Select Items</option>
<%
While Not objRec.EOF
%>
<option value="<%=objRec.Fields("CustomerID").Value%>"><%=objRec.Fields("Name").Value%></option>
<%
objRec.MoveNext
Wend
%>
</select>
<%
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
</body>
</html>
|
|
|
|
|
Date :
2009-10-25 21:19:03 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากมายคะได้สักที
|
|
|
|
|
Date :
2009-10-25 21:50:17 |
By :
test |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|