protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string deger = Request.QueryString["bulid"];
mydataset dataSet = new mydataset();
// Veritabani baglantisi ve sorgu olusturma
string connectionString = @"Data Source=DESKTOP-1B3OQRL;Initial Catalog=ibroz;Integrated Security=True";
// SqlConnection, SqlDataAdapter ve DataTable kullanarak veritabanindan veri alabilirsiniz
using (SqlConnection connection = new SqlConnection(connectionString))
{
// Veritabanindan veri çekme
SqlDataAdapter da = new SqlDataAdapter("SELECT urun.*, resim.* FROM urun INNER JOIN resim ON urun.id = resim.urunid WHERE urun.id = @id", connection);
da.SelectCommand.Parameters.AddWithValue("@id", deger);
// "urun" ve "resim" tablolarini ayri ayri doldurma
DataTable urunTable = new DataTable("urun");
DataTable resimTable = new DataTable("resim");
da.Fill(urunTable);
da.Fill(resimTable);
// DataSet'e tablolari ekleme
dataSet.Tables.Add(urunTable);
dataSet.Tables.Add(resimTable);
// Toplam uygun kayit sayisini baslatma
int uygunKayitSayisi = 0;
// Her bir resim için islem yapma
foreach (DataRow row in dataSet.Tables["resim"].Rows)
{
// Resim bilgilerini al
string urunid = row["urunid"].ToString();
string resimYolu = "resimler/" + row["buyukyol"].ToString(); // Resimler klasörünü düzeltme
// Eger resmin urunid'si belirtilen degere esitse islem yap
if (urunid == deger)
{
// Her bir uygun kayit için pop-up mesajini göster
string script = "alert('ID: " + row["id"] + ", UrunID: " + urunid + ", BuyukYol: " + resimYolu + "');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup" + urunid + Guid.NewGuid().ToString(), script, true);
// Resmi ekrana göster
string resimScript = "<script>var resim = new Image(); resim.src = '" + resimYolu + "'; document.body.appendChild(resim);</script>";
ScriptManager.RegisterStartupScript(this, this.GetType(), "resim" + urunid + Guid.NewGuid().ToString(), resimScript, false);
// Her bir uygun kayit için uygun kayit sayisini arttir
uygunKayitSayisi++;
}
}
// Veri kaynaklarini rapora ekleme (sadece resim tablosunu kullaniyoruz)
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("report1.rdlc");
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("urun", dataSet.Tables["urun"]));
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("resim", dataSet.Tables["resim"]));
ReportViewer1.LocalReport.EnableExternalImages = true;
ReportViewer1.LocalReport.Refresh();
// Toplam uygun kayit sayisini bildiren mesaji göster
string mesaj = "alert('Toplam " + uygunKayitSayisi + " kayit bulundu.');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "kayitBilgilendirme" + Guid.NewGuid().ToString(), mesaj, true);bir
}
}
}
I have a code like this. This code works fine in Reportviever, but the images do not appear. There are two list elements, report1.rdlc. Among them, there are elements of the product dataset coming from mydataset.
In this, product dataset id and name image dataset id, product id and buyukyol buyukyol also takes the path of the image files in the pictures folder like / pictures / 1.jpg / pictures / 2.jpg. I said image in the 2nd list element. ise = Fields!buyukyol.Value I said this, the images do not appear, but if I say like this
I said = external. If I say "file://"+Fields!buyukyol.value to the value, it puts the same image in all the images that the product id is related to. In short, = Fields!buyukyol.Value. This does not work. For some reason, I added this in the field (image) main title in fx.