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 = "";
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.

Naimish MakwanaPosted Apr 15, 2024, 4:23 AM
It seems like you’re having trouble displaying images in your RDLC report. The issue might be related to the way you’re referencing the image path in your report.
When you’re setting the image source in your RDLC report, you need to ensure that the path is correctly referenced. Here’s a few things you could check:
Correct Image Path: Ensure that the image paths stored in your
buyukyolfield are correct and the images exist at those locations. The path should be the absolute path of the image file on the server.Image Source Type: In the properties of the image in the RDLC report, make sure you’ve set the
Sourceproperty toExternal. This tells the report viewer that the image source is an external file.MIME Type: Set the
MIMETypeproperty of the image to the correct image format (e.g.,image/jpegfor .jpg files).Value Expression: The
Valueproperty of the image should be an expression that gives the full path of the image. IfFields!buyukyol.Valuecontains the full path of the image, you can setValueto=Fields!buyukyol.Value. If it only contains the image file name, you might need to prepend it with the path of the image folder, like="file://" & Fields!buyukyol.Value.Remember, the path you provide should be accessible by the ReportViewer at runtime. If the images are stored in a location not accessible by the application, they will not be displayed.
Thanks