-4
// this the code of the linked database with page
protected void Page_Load(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(Request.QueryString["IDContent"]))
{
Response.Redirect("ContentList.aspx");
}
if (!String.IsNullOrEmpty(Request.QueryString["IDContent"]))
{
if (!IsPostBack)
//からデータをインポートするたconnectionString私はすべてここに提出された空の
{
SqlConnection Cn = new SqlConnection("Data Source = Lenovo;Initial Catalog = Web_Data; Integrated Security = True");
Cn.Open();
string Sql = "Select * From Content_Table Where IDContent = @IDContent";
DataTable Dt = new DataTabel();
SqlDataAdapter Da = new SqlDataAdapter(Sql, Cn);
Da.SelectCommand.Parameters.AddWithValue("IDContent", Request.QueryString["IDContent"]);
Da.Fill(Dt);
Cn.Close();
//コードですfindeページを開いたとき、私は、asp.netページへのデータのインポートに問題がありますSQL Serverの
if (Dt.Rows.Count > 0)
{
TxtCategory2.SelectedValue = Dt.Rows[0]["FIDContent"].ToString();
TxtTitel2.Text = Dt.Rows[0]["ContentTitel"].ToString();
TxtDateTime2.Text = Dt.Rows[0]["ContentDateTime"].ToString();
TxtSummary2.Text = Dt.Rows[0]["ContentSummary"].ToString();
TextImage.Text = Dt.Rows[0]["ContentImage"].ToString();
TxtText2.Text = Dt.Rows[0]["ContentText"].ToString();
Image1.ImageUrl = TextImage.Text;
}
else
{
LbMsg2.Text = " The Content is not exist!";
}
}
}
}
例外が表示されるか、「コンテンツが存在しません!」というメッセージが表示されますか。 – mybirthname
いいえ実際には私はページの読み込み時にデータをインポートしています – Fow