using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
public partial class PopulateJSArray3 : System.Web.UI.Page
{
#region Private Variables
protected DataTable dtCategories;
#endregion
#region Overriden Events
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
LoadDataTable();
}
#endregion
#region Private Methods
private void LoadDataTable()
{
using (SqlConnection connection = new SqlConnection("Data Source=.;Initial Catalog=Northwind;Integrated Security=SSPI"))
{
connection.Open();
using (SqlDataAdapter adapter = new SqlDataAdapter("Select CategoryName,Description from Categories", connection))
{
dtCategories = new DataTable();
adapter.Fill(dtCategories);
}
connection.Close();
}
}
#endregion
}
มีข้อสังเกตตรง connection Data Source=.;Initial Catalog=Northwind;Integrated Security=SSPI
ผมว่าน่าจะิผิดนะครับ