السلام عليكم ورحمة الله وبركاته
ارجو المساعدة في هذه المشكلة لأنها تسبب لي ازعاجا شديدا
انا بشتغل ASP.NET بلغة #C ورابط الداتا بيز بالسايت وبتواجهني مشكلة في اظهار الصورة من Column في table عندي في الداتا بيز معمول الصيغى بتاعته image وهوريكوا بالصور انا اقصد ايه نيجي الاول لصفحة الفورم بتاعت الادمن اللي بيعمل insert للداتا

ولو لاحظت هتلاقي فوق في الداتا جريد مكان الصورة موجود بس فاضي مش ظاهر حاجة ظاهر ان في صورة لكن مش عايز تظهر لكن لو رحت على الداتا بيز هلاقيها موجودة وموجودة صح كمان اسمها ونوعها والصورة دي برنتاية من جوة الجدول

ودلوقتي هحط اول حاجة السورس بتاع الصفحة ال ASP : ويا ريت لو فيه غلطة ارجو التوضيح
<%@ Page Title="Dentist Admin Panel" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Dentist admin.aspx.cs" Inherits="WebApplication1.WebForm11" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="margin-left: 227px" >
<div>
<br />
<div style="width: 605px; text-align: center; margin-left: 239px; font-weight: 700; color: #CC0000; font-size: xx-large; font-family: Andalus;">
<strong>Welcome To Dentist Admin Page</strong><strong><br >
</strong><strong>You Can Edit Or Delete Or Insert Data To
Dentist Table</strong></div>
<strong>
<br>
</div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="d_id" DataSourceID="SqlDataSource1" ForeColor="#333333"
style="font-size: small; margin-left: 186px;" AllowSorting="True"
Width="685px" GridLines="None"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowSelectButton="True" />
<asp:BoundField DataField="d_id" HeaderText="ID" ReadOnly="True"
SortExpression="d_id" />
<asp:BoundField DataField="d_name" HeaderText="Name"
SortExpression="d_name" />
<asp:BoundField DataField="d_phone" HeaderText="Phone"
SortExpression="d_phone" />
<asp:BoundField DataField="d_address" HeaderText="Address"
SortExpression="d_address" />
<asp:ImageField DataImageUrlField="d_id"
DataImageUrlFormatString="ImageHandler.aspx?ImageID={0}"
ControlStyle-Width="50" ControlStyle-Height="75" HeaderText="Display Image">
</asp:ImageField>
</Columns>
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DentistryConnectionString %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT [d_id], [d_name], [d_phone], [d_address], [d_image] FROM [Dentist]"
DeleteCommand="DELETE FROM [Dentist] WHERE [d_id] = @original_d_id AND [d_name] = @original_d_name AND [d_phone] = @original_d_phone AND (([d_address] = @original_d_address) OR ([d_address] IS NULL AND @original_d_address IS NULL)) AND (([d_image] = @original_d_image) OR ([d_image] IS NULL AND @original_d_image IS NULL))"
InsertCommand="INSERT INTO [Dentist] ([d_id], [d_name], [d_phone], [d_address], [d_image]) VALUES (@d_id, @d_name, @d_phone, @d_address, @d_image)"
UpdateCommand="UPDATE [Dentist] SET [d_name] = @d_name, [d_phone] = @d_phone, [d_address] = @d_address, [d_image] = @d_image WHERE [d_id] = @original_d_id AND [d_name] = @original_d_name AND [d_phone] = @original_d_phone AND (([d_address] = @original_d_address) OR ([d_address] IS NULL AND @original_d_address IS NULL)) AND (([d_image] = @original_d_image) OR ([d_image] IS NULL AND @original_d_image IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_d_id" Type="Int32" />
<asp:Parameter Name="original_d_name" Type="String" />
<asp:Parameter Name="original_d_phone" Type="String" />
<asp:Parameter Name="original_d_address" Type="String" />
<asp:Parameter Name="original_d_image" Type="Object" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="d_id" Type="Int32" />
<asp:Parameter Name="d_name" Type="String" />
<asp:Parameter Name="d_phone" Type="String" />
<asp:Parameter Name="d_address" Type="String" />
<asp:Parameter Name="d_image" Type="Object" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="d_name" Type="String" />
<asp:Parameter Name="d_phone" Type="String" />
<asp:Parameter Name="d_address" Type="String" />
<asp:Parameter Name="d_image" Type="Object" />
<asp:Parameter Name="original_d_id" Type="Int32" />
<asp:Parameter Name="original_d_name" Type="String" />
<asp:Parameter Name="original_d_phone" Type="String" />
<asp:Parameter Name="original_d_address" Type="String" />
<asp:Parameter Name="original_d_image" Type="Object" />
</UpdateParameters>
</asp:SqlDataSource>
<div style="width: 503px; margin-left: 292px">
<br />
<strong>Insert
Data In Dentist Table :</strong><br> ID :
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br __designer:mapid="51" />
Name :
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br __designer:mapid="53" />
address :
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br __designer:mapid="55" />
phone :
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
Dentist Image :
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<br __designer:mapid="57" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Enter Your Data" />
</div>
</div>
</strong>
</asp:Content>
<asp:Content ID="Content3" runat="server" contentplaceholderid="head">
<style type="text/css">
.style17
{
text-align: left;
}
</style>
</asp:Content>ودة كود الصفحة Dentist admin.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.IO;
namespace WebApplication1
{
public partial class WebForm11 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["type"].ToString() != "admin")
{
Page.Visible = false;
}
else
{
}
}
protected void Button1_Click(object sender, EventArgs e)
{
DataSet1 ds = new DataSet1();
DataSet1TableAdapters.DentistTableAdapter dr = new DataSet1TableAdapters.DentistTableAdapter();
dr.Fill(ds.Dentist);
DataSet1.DentistRow or = ds.Dentist.NewDentistRow();
string path = FileUpload1.PostedFile.FileName;
string filename = Path.GetFileName(path);
string extension = Path.GetExtension(filename);
string type = string.Empty;
switch(extension)
{
case ".jpg" :
type = "image/jpg";
break;
case ".png" :
type = "image/png";
break;
case ".gif" :
type = "image/gif";
break;
}
if (type != String.Empty)
{
//Begin query insert
string ConnectionString = "Data Source=.;Initial Catalog=Dentistry;Integrated Security=True";
Stream fs = FileUpload1.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
SqlConnection con = new SqlConnection(ConnectionString);
try
{
con.Open();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
string Query = "insert into Dentist(d_id,d_name,d_phone,d_address,d_image,d_imageName,d_imageContent)" +
" values (@ID,@Name, @Phone, @Address,@Data,@ImageName,@Type)";
using (SqlCommand exec = new SqlCommand(Query,con))
{
exec.Parameters.Add("@ID", SqlDbType.Int).Value = int.Parse(TextBox1.Text);
exec.Parameters.Add("@Name", SqlDbType.VarChar).Value = TextBox2.Text;
exec.Parameters.Add("@Phone", SqlDbType.VarChar).Value = TextBox4.Text;
exec.Parameters.Add("@Address", SqlDbType.VarChar).Value = TextBox3.Text;
exec.Parameters.Add("@Data", SqlDbType.Binary).Value = bytes;
exec.Parameters.Add("@Type", SqlDbType.VarChar).Value = type;
exec.Parameters.Add("@ImageName", SqlDbType.VarChar).Value = filename;
try
{
exec.ExecuteNonQuery();
Response.Write("Query Executed");
}
catch (Exception exx)
{
Response.Write(exx.Message);
}
}
}
else
{
//something went wrong
}
//dr.Insert(int.Parse(TextBox1.Text), TextBox2.Text, TextBox4.Text, TextBox3.Text,FileUpload1.FileBytes);
//dr.Insert(int.Parse(TextBox1.Text), TextBox2.Text, TextBox4.Text, TextBox3.Text,FileUpload1.FileBytes);
//dr.Insert(int.Parse(TextBox1.Text), TextBox2.Text, TextBox4.Text, TextBox3.Text,FileUpload1);
dr.Fill(ds.Dentist);
//GridView1.DataSource = ds.Dentist;
GridView1.DataBind();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}ودة كود صفحة ImageHandler.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace WebApplication1
{
public partial class WebForm29 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["ImageID"] != null)
{
string Query = "SELECT d_imageName,d_imageContent,d_image FROM Dentist WHERE d_id=@ID";
string ConnectionString = "Data Source=.;Initial Catalog=Dentistry;Integrated Security=True";
SqlConnection con = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand(Query);
SqlDataAdapter data = new SqlDataAdapter();
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = con;
DataTable dt = new DataTable();
try
{
con.Open();
data.SelectCommand = cmd;
data.Fill(dt);
}
catch
{
dt = null;
}
finally
{
con.Close();
data.Dispose();
con.Dispose();
}
if (dt != null)
{
Byte[] bytes = (Byte[])dt.Rows[0]["d_image"];
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = dt.Rows[0]["d_imageContent"].ToString();
Response.AddHeader("content-disposition", "attachment;filename=" + dt.Rows[0]["d_imageName"].ToString());
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
}
}
}
}ارجوكوا اللي عنده حل يفيدني انا كل اللي عايزه ان زي ما الصورة بتترفع على الداتا بيز بنجاح انها تظهر في الداتا جريد فيو لليوزر بس