この奇妙な動作に対する正しい解決策が見つかりません。別のプロジェクトでは、これは魅力のように機能します。そのsqlconnectionを解決し、System.Data.SqlClientを使用して使用すると、executereaderの下にこの赤い下線が表示されます....なぜこのように動作するのですか?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.SqlClient;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//*********************************
//Definerer connection stringen *
//*********************************
SqlConnection BilleddataBasen = new SqlConnection(WebConfigurationManager.ConnectionStrings["Boligforeningen_AB8"].ConnectionString);
//**************************************
//Definerer de forskellige variabler *
//**************************************
string ImageFilePath = "";
string ImageName = "";
string OverfoereDataTilImageControlPaaAspxSiden = "";
//**************************************************
//Definerer hvordan der skal læses fra databasen *
//**************************************************
SqlCommand SelectBlogIndlæg = new SqlCommand("SELECT FileName, FilePath, OprettelsesDato, Tittel, BilledetsIndhold FROM BillederTilGalleri", BilleddataBasen);
BilleddataBasen.Open();
SqlDataReader reader = BilleddataBasen.ExecuteReader();
while (reader.Read())
{
ImageName += reader["FileName"];
ImageFilePath += reader["FilePath"];
lbl_OprettelsesDato.Text += reader["OprettelsesDato"];
lbl_BilledNavnet.Text += reader["Tittel"];
lbl_BeskrivelseAfBilledet.Text += reader["BilledetsIndhold"];
}
OverfoereDataTilImageControlPaaAspxSiden = ImageFilePath + ImageName;
lbl_BilledFraDataBasen.ImageUrl = OverfoereDataTilImageControlPaaAspxSiden;
//************************************************
//Følgende to linier bestemmer pixel størrelse *
//************************************************
lbl_BilledFraDataBasen.Width = 300;
lbl_BilledFraDataBasen.Height = 250;
//*************************************
//Lukker ned for database tilgangen *
//*************************************
reader.Close();
BilleddataBasen.Close();
}
}