 |
|
ทำแล้ว err ครับช่วยด้วย code asp ครับ ผมไม่สามารถเรียกไฟล์ dbconnect.asp |
|
 |
|
|
 |
 |
|
'Set Conn=Server.Createobject("ADODB.Connection")
'Conn.Open "jnm","sa",""
'<!--#include file="dbconnect.asp"-->
<!-- #include virtual="dbconnect.asp"--> ================== บรรทัดนี้ต้องเอาไว้ในส่วนที่ไม่ใช่ asp นะครับ ตัวอย่างเช่น
<!-- #include virtual="dbconnect.asp"-->
<%
asp statement
.
.
.
%>
ต้องเป็นแบบดังกล่าวนะครับถึงจะสามารถ Include ได้ เพราะว่าใน asp ไม่มีคำสั่งในการ Include file นะครับ
ที่ถูกน่าจะเป็นแบบนี้นะครับ
gPage= 1
gname=request.form ("1")
if gname="" then %> <a href="index.asp">¡ÅѺ˹éÒáá</a> <% else
serallchk=request.form ("search")
'Set Conn=Server.Createobject("ADODB.Connection")
'Conn.Open "jnm","sa",""
%>
<!-- #include virtual="dbconnect.asp"-->
<%
Set RS =Server.CreateObject("ADODB.Recordset")
if serallchk="name" then
gname=request.form ("1")
sql ="Select * from BcAr where name1 like '%"& gname &"%' ;"
else if serallchk="address" then
gname=request.form ("1")
sql ="Select * from BcAr where billAddress like '%"& gname &"%' ;"
else
gname=request.form ("1")
sql ="Select * from bcAr where code like'%"& gname &"%' or Name1 like'%"& gname &"%' or billAddress like'%"& gname &"%' ;"
end if
end if
rs.Open sql,conn,1, 3
TotalRow = rs.RecordCount
rs.PageSize = 20
IF TotalRow=0 THEN%>
<table align="center" border="0" width="50%" cellspacing="0">
<tr >
<td align="center" bgcolor=#33ccff><font color=#6633ff face="MS Sans Serif" size="1">äÁ辺¢éÍÁÙÅ </font></td>
<td align="center" bgcolor=#33ccff><font color=#ff33cc face="MS Sans Serif" size="1"><%=gname%></font></td>
<td align="center" bgcolor=#33ccff><font color=#6633ff face="MS Sans Serif" size="1"> ¡ÃسҵÃǨÊͺãËÁè</font>?</td>
<br>
</tr>
</table>
<center>
<a href="index.asp">¡ÅѺ˹éÒáá</a>
</center>
<%else
TotalPage = rs.PageCount
rs.Absolutepage =gPage
count=1
flag=1
%>
<table border="0" align="center" width="90%">
<tr bgcolor=#33ccff>
<td align="center" ><font face="MS Sans Serif" size="1">ÃËÑÊÅÙ¡¤éÒ:</font></td>
<td align="center"><font face="MS Sans Serif" size="1">ª×èÍ - ¹ÒÁÊ¡ØÅ:</font></td>
<td align="center"><font face="MS Sans Serif" size="1">·ÕèÍÂÙè:</font></td>
<td align="center"><font face="MS Sans Serif" size="1">â·ÃÈѾ·ì:</font></td>
</tr>
<%
Do while Not rs.EOF and count <= rs.PageSize
IF flag =1 THEN
flag = 0
%>
<tr >
<form action="buyproduct.asp" method="post">
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><%= rs("code")%></font></td>
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><a href="AR.asp?code=<%= rs("code")%>"><%= rs("name1") %></a></font></td>
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><%= rs("billaddress") %> </font></td>
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><%= rs("Telephone") %> </font></td>
</form>
</tr>
<%
Else
flag = 1
%>
<tr >
<form action="buyproduct.asp" method="post">
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><%= rs("code")%></font></td>
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><a href="AR.asp?code=<%= rs("code")%>"><%= rs("name1") %></a></font></td>
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><%= rs("billaddress") %> </font></td>
<td align="left" valign="top" bgcolor="#CCFFFF">
<font color=#6633ff face="MS Sans Serif" size="1"><%= rs("Telephone") %> </font></td>
</form>
</tr>
<%end if
rs.MoveNext
count = count + 1
Loop
rs.close
conn.close
end if%>
</table>
<TABLE width=90% border=0 cellspacing=0 cellpadding=0 align="center">
<TR>
<TD COLSPAN=2 >
<table BORDER=0 cellspacing=0 cellpadding=0>
<tr>
<td height=4></td>
</tr>
</table>
</TD>
</TR>
<TR>
<TD COLSPAN=2>
<TABLE border=0 cellspacing=2cellpadding=2 >
<TR>
<TD> <FONT FACE="MS Sans Serif,CordiaUPC" Size ="1">˹éÒ :</font></TD>
<%For pg = 1 to TotalPage %>
<TD BGCOLOR="#FFCC99"> <%IF pg=cint(cstr(gPage)) Then %> <blink><B><Font color = Red FACE="MS Sans Serif,CordiaUPC" Size ="1">
<%= pg%></font></B> </blink> <%Else%> <B><A HREF ='SearchAr2.asp?PageNo=<%= pg%>&gname=<%=gname%>'><FONT FACE="MS Sans Serif,CordiaUPC" Size ="1"><%=pg%></font></A></B>
<%End IF%> </TD>
<%Next
end if%> </TR>
</Table>
</Table>
</font>
เห่อ ๆ ปามาณนี้แหละมั้ง ลองดูนะ
|
 |
 |
 |
 |
Date :
11 มี.ค. 2549 07:59:20 |
By :
นายกระจอก |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ ผมทำได้แล้วครับ
|
 |
 |
 |
 |
Date :
11 มี.ค. 2549 21:48:47 |
By :
kao |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
CD 30 เพื่อศึกษาและวิจัย เกม ซอฟร์แวร์ แผ่นสอน และอื่น ๆ อีกมากมายเชิญชมที่ http://www.cookies.such.info
|
 |
 |
 |
 |
Date :
20 มี.ค. 2549 03:09:09 |
By :
dos |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|