Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server ASP.NET动态数据图像字段模板_Sql Server_Image Uploading_Asp.net Dynamic Data - Fatal编程技术网

Sql server ASP.NET动态数据图像字段模板

Sql server ASP.NET动态数据图像字段模板,sql-server,image-uploading,asp.net-dynamic-data,Sql Server,Image Uploading,Asp.net Dynamic Data,我和动态数据发生了一场小冲突。我有一个自定义的数据库图像字段模板,允许用户上传和编辑图像,插入有效,但更新无效。我可以通过在以下代码(在DBImage_Edit.ascx.cs中)中设置uri的位置周围删除if insert模式来进行更新: 综上所述,如果在编辑时将uri设置为与数据库中以前的值不同的值,则会成功上载新图像。如果uri与数据库中的上一个值相同,即使filecontents和contenttype发生了更改,SQL Server也永远不会得到消息 元数据: ... [Display

我和动态数据发生了一场小冲突。我有一个自定义的数据库图像字段模板,允许用户上传和编辑图像,插入有效,但更新无效。我可以通过在以下代码(在DBImage_Edit.ascx.cs中)中设置
uri
的位置周围删除if insert模式来进行更新:

综上所述,如果在编辑时将uri设置为与数据库中以前的值不同的值,则会成功上载新图像。如果uri与数据库中的上一个值相同,即使filecontents和contenttype发生了更改,SQL Server也永远不会得到消息

元数据:

...
[DisplayName("Uri")]
[ScaffoldColumn(true)]
[Required]
public object uri { get; set; }

[DisplayName("Graphic")]
[ScaffoldColumn(true)]
[UIHint("DBImage")]
public object filecontents { get; set; }
...
我还删除了UpdateCheck,但这似乎没有改变行为:

[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_filecontents", DbType="VarBinary(MAX)")] //, UpdateCheck=UpdateCheck.Never
public System.Data.Linq.Binary filecontents
  {
    get
    {
...
(请参见上面注释掉的UpdateCheck=UpdateCheck.Never)

亲切问候,


乔丹

我独自呆了一个星期,回来后很容易就明白了。。有时候你只需要去散散步,而不是去想这些事情

问题是缓存。我通过在OnDataBinding中添加nocache参数更改了图像处理程序url:

旧版:

ImageEdit.ImageUrl = "http://localhost/WebServices.CAD/ImageHandler.ashx?uri=" + row.uri;
ImageEdit.ImageUrl = "http://localhost/WebServices.CAD/ImageHandler.ashx?nocache=" + System.DateTime.Now.Ticks.ToString() + "&uri=" + row.uri;
新建:

ImageEdit.ImageUrl = "http://localhost/WebServices.CAD/ImageHandler.ashx?uri=" + row.uri;
ImageEdit.ImageUrl = "http://localhost/WebServices.CAD/ImageHandler.ashx?nocache=" + System.DateTime.Now.Ticks.ToString() + "&uri=" + row.uri;
按设计工作