|
<%@Page Language="C#"%>
<%@Import Namespace="System.Data"%>
<%@Import Namespace="System.Data.SqlClient"%>
<%@Import Namespace="System.Configuration"%>
<script runat="server">
public void Page_Load(object sender,EventArgs args)
{
string keyword=Request["k"];
if(keyword!=null && keyword.Trim()!="")
{
string sql="select top 10* from WordList where word like '"+keyword.Trim().Replace("'","''")+"%'";
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
conn.Open();
DataTable dt=new DataTable();
SqlCommand command=new SqlCommand(sql,conn);
SqlDataAdapter adapter=new SqlDataAdapter(command);
adapter.Fill(dt);
conn.Close();
foreach(DataRow row in dt.Rows)
{
string meaning=row["Meaning"].ToString();
Response.Write("<strong>"+row["Word"].ToString()+"</strong> <i>"+row["Type"].ToString()+"</i>: "+meaning+"<br>");
}
}
}
</script>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.