原作者:http://www.verydemo.com/demo_c107_i15115.html
一、AjaxMethod
using System;
using System.Data;
using System.Data.SqlClient;
namespace AjaxImage
{
/**//// <summary>
/// AjaxMethod 的摘要说明。
/// </summary>
public class AjaxMethod
{
public AjaxMethod()
{
}
public static string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString();
GetDataSet#region GetDataSet
public static DataSet GetDataSet(string sql)
{
SqlDataAdapter sda = new SqlDataAdapter(sql, ConnectionString);
DataSet ds = new DataSet();
sda.Fill(ds);
if (ds != null)
return ds;
else
return null;
}
#endregion
[AjaxPRo.AjaxMethod]
public static DataSet GetPhotoList( int iCategoryID )
{
string sql = "Select id,photo_path FROM Photo where photo_category_id=" + iCategoryID ;
return GetDataSet( sql );
}
[AjaxPro.AjaxMethod]
public static DataSet GetPhotoInfo( int id )
{
string sql = string.Format("SELECT photo_title, photo_description FROM Photo WHERE id = {0}", id);
return Get…………………………………………………………………………
本文介绍了一个名为AjaxMethod的类,该类提供了一系列用于从数据库获取照片列表和详细信息的方法。通过使用SqlConnection和SqlDataAdapter等组件,实现了数据集的填充与返回。文章提供了具体的实现代码示例。
212

被折叠的 条评论
为什么被折叠?



