一、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);