我在asp.net中创建了多语言网站,但我想从db只获取英文数据,但现在所有数据都来自我的about.aspx页面。请帮助我??
public partial class About : System.Web.UI.Page
{
protected override void InitializeCulture()
{
string strLang;
if (Session["lang"] == null)
{
strLang = "en-GB";
}
else
{
strLang = Session["langl"].ToString();
}
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(strLang);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(strLang);
base.InitializeCulture();
}
protected void Page_Load(object sender, EventArgs e)
{
rpAbout.DataSource = DataAccesLayer.About.GetAbout();
rpAbout.DataBind();
}
}
存储过程
SELECT About.[AboutID],
Languages.Name as LangCode
,[About].[AboutUs],[About].[AboutUs],[About].[Mission],[About].[Vision],[About].[AboutPhoto],
case when About.IsActive='True' then 'Active' else 'Passive'end as Statu
FROM [dbo].[About]
INNER JOIN Languages on About.LangCode = Languages.Code
Where About.Statu='True' Order by Statu,Languages.Name
答案 0 :(得分:2)
您的存储过程会加载所有记录。您需要传递failure
参数并向l
添加条件,以便仅选择where
与Languages.Code
匹配的记录。