This is a migrated thread and some comments may be shown as answers.

[Solved] SQL Blob Fields

2 Answers 316 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 09 Oct 2009, 10:45 AM
Hi Telerik team,

WE are writting an internal project to handle our databases for us, we are currently testing to see if RadGrid would be good enougth to use to display the data given a SQL data source.  This is all fine and the datagrid creates the columns and rows for the sql datasource it is given.

The only exception is that in some of our database tables we have BLOB fields, these basically store byte data.  It could essentially be anything from an image to a zip file.  Since the datagrid does not recognise the BLOB field when using something like below:

<asp:SqlDataSource ID="DS" runat="server"   
    ConnectionString="Provider=SQLOLEDB.1;Data Source=evolve;Persist Security Info=True;User ID=sa;Initial Catalog=nvis"   
    DeleteCommand="DELETE FROM [images] WHERE [ref] = ? AND [Typ] = ?"   
    InsertCommand="INSERT INTO images (ref, Typ, ext, added, modified) VALUES (?, ?, ?, ?, ?)"   
    ProviderName="System.Data.OleDb" SelectCommand="SELECT * FROM [images]"   
    UpdateCommand="UPDATE [images] SET [img] = ?, [ext] = ?, [added] = ?, [modified] = ? WHERE [ref] = ? AND [Typ] = ?">  
    <DeleteParameters> 
        <asp:Parameter Name="ref" Type="String" /> 
        <asp:Parameter Name="Typ" Type="String" /> 
    </DeleteParameters> 
    <UpdateParameters> 
        <asp:Parameter Name="ext" Type="String" /> 
        <asp:Parameter Name="added" Type="DateTime" /> 
        <asp:Parameter Name="modified" Type="DateTime" /> 
        <asp:Parameter Name="ref" Type="String" /> 
        <asp:Parameter Name="Typ" Type="String" /> 
    </UpdateParameters> 
    <InsertParameters> 
        <asp:Parameter Name="ref" Type="String" /> 
        <asp:Parameter Name="Typ" Type="String" /> 
        <asp:Parameter Name="ext" Type="String" /> 
        <asp:Parameter Name="added" Type="DateTime" /> 
        <asp:Parameter Name="modified" Type="DateTime" /> 
    </InsertParameters> 
</asp:SqlDataSource> 

there is a field in that table called img.  This is a blob field, it will serve the image if i used a

<telerik:GridBinaryImageColumn DataField="img"></telerik:GridBinaryImageColumn> 

The only problem is like i said since we are swapping datasources depending on the connection string and table selected the blob field may not be an image it could be anything.  Is there anyway to get the grid to create the column for these blob fields, and if necessary just let the user know its a blob field.  We can move onto displaying the data at a later date (i.e. if its an image display it, if its a zip then just display the binary data/string of bytes.)

I hope i have explained that correctly...

Regards

Ian Ramsay
Programmer
Imagered Ltd
www.imagered.co.uk

2 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 14 Oct 2009, 03:05 PM
Hello Ian,

Thank you for the detailed explanation.

Indeed the built-in GridBinaryImageColumn can handle only images streamed from binary array (blob field in the source in your case), hence it is not applicable for your configuration.

However, you may be happy to know that we will introduce new GridAttachmentColumn for the Q3 2009 release of RadGrid for ASP.NET AJAX, scheduled in the beginning of November. Public Beta will be announced at the end of this week and I suggest you try it out and see whether this new built-in column suits your needs.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ian
Top achievements
Rank 1
answered on 14 Oct 2009, 03:49 PM
Thanks for the reply and i look forward to trying out the new version :)

Regards

Ian Ramsay
Programmer
Imagered Ltd
http://www.imagered.co.uk
Tags
Grid
Asked by
Ian
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Ian
Top achievements
Rank 1
Share this question
or