Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP Forum > ช่วยดูโค้ดให้หน่อยค่ะต้องการให้มันค้นหาข้อมูลได้ 2 Keyword คือค้นหาจาก รหัสหรือชื่อบริษัท หรือทั้งสองยังพร้อมกันก็ได้



 

ช่วยดูโค้ดให้หน่อยค่ะต้องการให้มันค้นหาข้อมูลได้ 2 Keyword คือค้นหาจาก รหัสหรือชื่อบริษัท หรือทั้งสองยังพร้อมกันก็ได้

 



Topic : 062047



โพสกระทู้ ( 99 )
บทความ ( 0 )



สถานะออฟไลน์




ช่วยดูโค้ดให้หน่อยค่ะต้องการให้มันค้นหาข้อมูลได้ 2 Keyword คือค้นหาจาก รหัสหรือชื่อบริษัท หรือทั้งสองอย่างพร้อมกันก็ได้
Code (ASP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style7 {
	color: #7200A8;
	font-size: 14px;
}
body,td,th {
	font-family: Microsoft Sans Serif;
	font-size: 14px;
	color: #660000;
}
.style10 {font-family: Microsoft Sans Serif; font-weight: bold;}
.style12 {font-family: Microsoft Sans Serif}
a:link {
	color: #0000FF;
}
a:visited {
	color: #0000FF;
}
a:hover {
	color: #0000FF;
}
a:active {
	color: #0000FF;
}
.style13 {font-family:Microsoft Sans Serif; font-size: 14px; font-weight: bold; color: #000000; }
.style15 {font-family:Microsoft Sans Serif; font-weight: bold; color: #000000; }
.style16 {color: #000000}
-->
</style>
<style type="text/css">
body
{
	font:12px Verdana, Arial, Helvetica, sans-serif;
	margin-left: 0px;
}
.oddtr
{
	background-color:#ECECFF;
}
.eventr
{
	background-color:#DDDDFF;
}
.trover
{
	background-color: #E4CBCB;
}

.style20 {font-size: 9px}
.style20 {font-size: 9px}
.style29 {font-size: 14px}
.style30 {font-weight: bold; font-family: Microsoft Sans Serif;}
.style32 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #333333;
}
</style>
<script src="jquery.js"></script>
<script> 
$(function()
{
   
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use

	//these two line adds the color to each different row
   $("#mytable tr:even").addClass("eventr");;
   $("#mytable tr:odd").addClass("oddtr");;
   //handle the mouseover , mouseout and click event
   $("#mytable tr").mouseover(function() {$(this).addClass("trover");}).mouseout(function() {$(this).removeClass("trover");}).click(function() {$(this).toggleClass("trclick");}); 
   });
  </script></head>

<body>
<form id="form1" name="frmSearch" method="get" action="<%=Request.ServerVariables("QUOTATION")%>">
<table width="1079" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="1079" height="20" valign="middle" background="viewcustomer/p7.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="style7">&nbsp;: :&nbsp;<span class="style10">&nbsp;VIEW ALL QUOTATION  </span></span></td>
    </tr>
  <tr>
    <td height="25" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
</table>
<table width="1078" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="84" rowspan="2" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td width="88" height="52" valign="middle"><div align="right" class="style13">Quotation : </div></td>
    <td width="159" valign="middle"><label for="textfield"></label>
      &nbsp;
      <input type="text" name="txtKeyword" id="txtKeyword" value="<%=Request.QueryString("txtKeyword")%>"/></td>
    <td width="747" align="left" valign="middle">
      <label for="imageField"></label>
      <input type="image" name="imageField" src="viewcustomer/p2.gif" id="imageField" /></td>
    </tr>
  <tr>
    <td height="18" colspan="3" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
</table>
<%
	Dim Conn,strSQL,objRec
	Set Conn = Server.Createobject("ADODB.Connection")
	Conn.Open "Driver={SQL Server};Server=localhost;Database=mydatabase;Uname=THAISINTO/ADMINISTRATION;PWD=;" 
	'*** Search By Name or Email ***'
		strSQL = "select QUOTATION.*,cust_NAME.*,cust_add.* from QUOTATION,cust_NAME,cust_add where QUOTATION.customer_ID=cust_NAME.customer_ID and QUOTATION.add_ID=cust_add.add_ID and cust_NAME.cust_name LIKE '%"& Request.QueryString("txtKeyword") &"%' or QUOTATION.quote_no LIKE '%"& Request.QueryString("txtKeyword") &"%' "	
	Set objRec = Server.CreateObject("ADODB.Recordset")
	objRec.Open strSQL, Conn, 1,3
	
If objRec.EOF  Then
	Response.write("<font color=red>Not found data!</font>")
Else
	Dim PageLen,PageNo,TotalRecord,TotalPage,No,intID
	PageLen = 5
	PageNo = Request.QueryString("Page")
	if PageNo = "" Then PageNo = 1
	TotalRecord = objRec.RecordCount
	objRec.PageSize = PageLen
	TotalPage = objRec.PageCount
	objRec.AbsolutePage = PageNo
	 End IF
%>
<table width="1072" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="7" height="53"></td>
    <td colspan="2" valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666" id="mytable">
      <!--DWLayoutTable-->
      <tr>
        <td width="70" height="25" valign="middle" background="viewcustomer/p3.gif"><div align="center" class="style13">View</div></td>
            <td width="112" valign="middle" background="viewcustomer/p3.gif"><div align="center" class="style13">Quotation</div></td>
            <td width="359" valign="middle" background="viewcustomer/p3.gif"><div align="center" class="style13">Customer</div></td>
            <td width="172" valign="middle" background="viewcustomer/p3.gif"><div align="center" class="style13">Model</div></td>
            <td width="347" valign="middle" background="viewcustomer/p3.gif"><div align="center" class="style13">&nbsp;&nbsp;Description</div></td>
          </tr>
      <% 	
No=1
While Not objRec.EOF and No <= PageLen
%>
      <tr>
        <td height="25" valign="middle"><div align="center"><a href="viewquotation1.asp?CusID=<%=objRec.Fields("quote_no").Value%>" target="_top"><img src="quotation/p1.gif" alt="Edit" width="56" height="24"  border="0" /></a></div></td>
            <td valign="middle">&nbsp;<%=objRec.Fields("quote_no").Value%></td>
            <td valign="middle">&nbsp;<%=objRec.Fields("cust_name").Value%></td>
            <td valign="middle">&nbsp;<%=objRec.Fields("model").Value%></td>
            <td valign="middle">&nbsp;<%=objRec.Fields("quote_title").Value%></td>
          </tr>
      
      
      <%

 No = No + 1
objRec.MoveNext
Wend

%>    
    </table></td>
    </tr>
  <tr>
    <td height="48"></td>
    <td width="693" valign="top"> <span class="style15">Total</span><span class="style16"> :</span> <%=TotalRecord%> <span class="style15">Page</span><br />
      <span class="style15">Go to <span class="style12">:</span></span>
      <% For intID = 1 To TotalPage%>
      <% if intID = Cint(PageNo) Then%>
      <%=intID%>
      <%Else%>
      <a href="<%Request.ServerVariables("QUOTATION")%>?Page=<%=intID%>"><%=intID%></a>
      <%End IF%>
      <%Next%>
      <%
	objRec.Close()
	Conn.Close()
	Set objRec = Nothing
	Set Conn = Nothing

%></td>
    <td width="372">&nbsp;</td>
  </tr>
  <tr>
    <td height="701"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

</form>

</body>
</html>





Tag : ASP, Ms SQL Server 2005







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-06-22 14:21:01 By : gusjang View : 1371 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ใช้ OR ก็ถูกแล้วครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-22 15:56:31 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูโค้ดให้หน่อยค่ะต้องการให้มันค้นหาข้อมูลได้ 2 Keyword คือค้นหาจาก รหัสหรือชื่อบริษัท หรือทั้งสองยังพร้อมกันก็ได้
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่