ASP.net 2.0 连接infromix 数据库问题
下面代码 debug 能查出数据,但是我把代码放到IIS服务器上在网页上查询时就出以下错误訊息: 'IBM.Data.Informix.IfxConnection' 的型別初始設定式發生例外狀況。
protected void query_btn_Click(object sender, EventArgs e)
{
if (this.sql_ta.Text.Trim() == "")
{
Response.Write("<script>alert('填寫不完整!!')</script>");
return;
}
string strSql = this.sql_ta.Text.Trim();
if (strSql.ToLower().Contains("update ") || strSql.ToLower().Contains("delete ") || strSql.ToLower().Contains("into ")
|| strSql.ToLower().Contains("drop ") || strSql.ToLower().Contains("insert ") || strSql.ToLower().Contains("declare ")
|| strSql.ToLower().Contains("exec ") || strSql.ToLower().Contains("dbcc ") || strSql.ToLower().Contains("alter ")
|| strSql.ToLower().Contains("drop ") || strSql.ToLower().Contains("create ") || strSql.ToLower().Contains("backup ")
|| strSql.ToLower().Contains("add ") || strSql.ToLower().Contains("set ") || strSql.ToLower().Contains("open ")
|| strSql.ToLower().Contains("close ") || strSql.ToLower().Contains("use ") || strSql.ToLower().Contains("begin ")
|| strSql.ToLower().Contains("return ") || strSql.ToLower().Contains("go ") || strSql.ToLower().Contains("grant ")
|| strSql.ToLower().Contains("revoke ") || strSql.ToLower().Contains("commit ") || strSql.ToLower().Contains("rollback ")
)
{
Response.Write("<script>alert('查詢語句不合法!!')</script>");
return;
}
DataTable dt = null;
this.cnt_lab.Text = "";
try
{
dt = ReturnDt();
if (dt.Rows.Count > 10000)
{
Response.Write("<script>alert('查詢出的筆數超過1萬筆,請縮小查詢條件!!')</script>");
return;
}
this.cnt_lab.Text = "查詢出的筆數: " + dt.Rows.Count.ToString() + "筆";
SetGridData(dt);
}
catch (Exception ex)
{
ex.StackTrace.ToString();
Response.Write("<script>alert('查詢語句執行不成功!!')</script>");
}
finally
{
dt = null;
}
} asp.net 数据库
补充:.NET技术 , ASP.NET