ASP Query database A string exists in all tables

Source: Internet
Author: User
Tags table name

<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>www.111cn.net Tutorials </title>
<style>
td{
font-size:12px;
}
</style>

<body>
<table width= "border=" 0 "cellspacing=" 0 "cellpadding=" 0 ">
<form id= "Form1" Name= "Form1" method= "Post" action= "getall.asp" >
<tr>
<td><input name= "keyword" type= "text" id= "keyword"/>
<input type= "Submit" name= "Submission" value= "submitted"/></td>
</tr>
</form>
</table>

</body>

Find Code

<!--#include file= "adoconn.asp"-->
<%

Keyword=request ("keyword")
On Error Resume Next
Set Rs=conn.openschema (20)
K=0
Do Until Rs. Eof
If RS (3) = "TABLE" Then
Set Rs1=server. CreateObject ("Adodb.recordset")
Tablename=rs (2)
Sql= "SELECT * from [" &tablename&] "
Set rs1=conn.execute (SQL)
C=1
Do as not rs1.eof
For I=0 to Rs1.fields.count-1
Key=rs1.fields (i). Name
Value=rs1 (CSTR (key))
If InStr (value,keyword) >0 Then
K=1
Response.Write "Found: Table name:" &tablename& ", Field name" &key& ", section" &c& "Record," &rs1.fields (0). "Name & "=" &rs1 (rs1.fields (0). Name) & "<br>www.111cn.net"
End If
Next
C=c+1
Rs1.movenext
Loop
End If
Rs. MoveNext
Loop
If k=0 Then Response.Write "Sorry, didn't find!!! "
Set rs=nothing
Set conn=nothing
%>


Data Connection File
<%
db= "Database/myfuture_empty.mdb"
Set FSO = Server.CreateObject ("Scripting.FileSystemObject")
If FSO. FolderExists (server. MapPath ("include")) =false Then
Db= ". /"&db
End If
Set fso=nothing
Path=server.mappath (DB)
Set Conn=server.createobject ("ADODB. Connection ")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &path
Conn. Open ConnStr

Set Rs=server. CreateObject ("Adodb.recordset")
%>
<!--#include file= "function.asp"-->

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.