111,126
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class getValue : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string connectionString = "Data Source=MINFO66;Persist Security Info=True;User ID=minfodb;Password=minfodba;Unicode=True";
System.Data.OracleClient.OracleConnection oracle_conn = null;
System.Data.OracleClient.OracleCommand oracle_cmd = null;
try
{
string question_title = Request.QueryString["question_title"];
oracle_conn = new System.Data.OracleClient.OracleConnection(connectionString);
oracle_cmd = oracle_conn.CreateCommand();
oracle_conn.Open();
oracle_cmd.CommandText = @"SELECT QUESTION_TITLE
FROM BAIDUZHIDAO_QUESTIONS
WHERE QUESTION_TITLE LIKE " + "\"" + question_title + "%\"";
string result = Convert.ToString(oracle_cmd.ExecuteScalar());
Response.Write(result);
}
catch (Exception excpt)
{
Console.WriteLine(excpt);
}
finally
{
if (oracle_cmd != null)
{
oracle_cmd.Cancel();
oracle_cmd.Dispose();
}
if (oracle_conn != null)
{
oracle_conn.Close();
oracle_conn.Dispose();
}
}
}
}
object o = null;
string s = Convert.ToString(o);//s为""
// JScript 文件
var xmlHttp;
function getXMLHttpObject()
{
var xmlHttp = null;
try
{
xmlHttp = new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function stateChanged()
{
if (xmlHttp.readyState == 4)
{
document.getElementById("show").value = xmlHttp.responseText;
}
}
function doIt(value)
{
if (value.length == 0)
{
return ;
}
xmlHttp = getXMLHttpObject();
if (xmlHttp == null)
return ;
var url = "getValue.aspx";
url = url + "?question_title=" + value;
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}