|
|
|
asp สามารถแสดงชื่อคอลัมภ์ และ ข้อมูลในคอลัมภ์ ได้หรือไม่ อย่างไร รบกวนด้วยครับ |
|
|
|
|
|
|
|
Code (ASP)
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP & Microsoft Access Tutorial</title>
</head>
<body>
<%
Dim Conn,strSQL,objRec,arrField
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
Response.write "<b>Table customer have "& objRec.Fields.Count &" Fields.</b><br>"
For Each arrField In objRec.Fields
Response.write arrField.Name & "<br>"
Next
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
</body>
</html>
Go to : ASP Microsoft Access List Table Properties
|
|
|
|
|
Date :
2011-06-20 15:07:56 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ ขอเสริมถ้าจะให้แสดงข้อมูลในฟิลด์ จะต้องเพิ่มโค้ดอีก 1 บรรทัด
Code (ASP)
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP & Microsoft Access Tutorial</title>
</head>
<body>
<%
Dim Conn,strSQL,objRec,arrField
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
Response.write "<b>Table customer have "& objRec.Fields.Count &" Fields.</b><br>"
For Each arrField In objRec.Fields
Response.write arrField.Name & "<br>"
Response.write arrField.Value& "<br>" Next
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
</body>
</html>
|
|
|
|
|
Date :
2011-06-23 09:08:23 |
By :
arta |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เยี่ยม
|
|
|
|
|
Date :
2011-06-23 09:36:10 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แจ๋ม
|
|
|
|
|
Date :
2011-06-24 23:06:49 |
By :
เผด็จ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วถ้เป็ยphpอาะค่ะ
|
|
|
|
|
Date :
2011-08-06 16:30:09 |
By :
หญิง |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intNumField = mysql_num_fields($objQuery);
$i = 0;
echo "<b>Table customer have $intNumField Fields.</b><br>";
for($i=1;$i<$intNumField;$i++)
{
echo $i."=".mysql_field_name($objQuery,$i)." (".mysql_field_type($objQuery,$i).")<br>";
}
mysql_close($objConnect);
?>
</body>
</html>
Go to : PHP MySQL List Table Properties
|
|
|
|
|
Date :
2011-08-06 17:09:46 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|