Hi all, I did the following database search engine code which is not working ( I got it step by step from w3schools ) .. but It's giving a compilation error:
<%@dotnet.itags.org. Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim search, dbconn, sql, dbcomm, dbread
search = Request.QueryString("search")
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("db/db.mdb"))
dbconn.Open()
sql = "SELECT * FROM Table1 WHERE DESCRIPTION LIKE '%" & search & "%' ORDER BY DATE DESC"
dbcomm = New OleDbCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
Table1.DataSource = dbread
Table1.DataBlind()
dbread.Close()
dbconn.Close()
end sub
</script>
<html>
<head>
<title>zeid1</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" href="http://links.10026.com/?link=STYLE.css" />
</head>
<body>
<br /><center>
<table cellpadding="0" cellspacing="0" border="0">
<tr><td width="700" height="25" class="td1"> </td></tr>
<tr><td width="700" height="25"> </td></tr>
</table></center>
<form runat="server">
<asp:Repeater id="Table1" runat="server">
<HeaderTemplate><table cellpadding="0" cellspacing="0" border="0"></HeaderTemplate>
<ItemTemplate>
<tr><td width="700" height="25"><%#Container.DataItem("URL")%></td></tr>
<tr><td width="700" height="25"><%#Container.DataItem("DESCRIPTION")%></td></tr>
<tr><td width="700" height="25"><%#Container.DataItem("DATE")%></td></tr>
</ItemTemplate>
<FooterTemplate></table></FooterTemplate>
</asp:Repeater>
</form>
</body>
</html>
can some one correct it for me .. Thanks..Nevermind I had a mistake in spelling: DataBlind --> should be Databind hehe ;)
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment