在ASP.NET中创建安全的web站点(配置)(3)

2008-02-22 09:42:34来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

sqlCommand.Connection = sqlConnection;
}

/// <summary>
/// Access to our sql command
/// </summary>
protected SqlCommand Command
{
get { return sqlCommand; }
}

/// <summary>
/// Access to our data adapter
/// </summary>
protected SqlDataAdapter Adapter
{
get { return sqlDataAdapter; }
}

/// <summary>
/// Makes sure that everything is clear and ready for a new query
/// </summary>
protected void ResetSql()
{
if(sqlCommand != null)
{
sqlCommand = new SqlCommand();
sqlCommand.Connection = sqlConnection;
}
if(sqlDataAdapter != null)
sqlDataAdapter = new SqlDataAdapter();

if(sqlDataSet != null)
sqlDataSet = new DataSet();
}

/// <summary>
/// Runs our command and returns the dataset
/// </summary>
/// <returns>the data set</returns>
protected DataSet RunQuery()
{
sqlDataAdapter.SelectCommand = Command;

sqlConnection.Open();
sqlConnection.Close();

sqlDataAdapter.Fill(sqlDataSet);

return sqlDataSet;
}
}
}

http://blog.csdn.net/tielu0144/archive/2007/02/05/1502894.aspx

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:ASP.NET 2.0服务器控件开发精要

下一篇:过滤ASP.NET输出HTML中的无用空格