views:

24

answers:

1

I have application with following data flow:

SqlDatabase -> SqlDataAdapter + SqlCommandBuilder -> DataSet -> DataGridView

All conversions and bindings are automatic. This is all simple and functional and I can load all kinds of databases with simple code. Problem is with BLOBs, they are treated as Image in DataGridView. My question is how to handle BLOBs that are not Images and show them as I want with minimal work?

Ugly alternative that comes in mind when BLOB is some kind of text is:

SqlDatabase -> SqlDataAdapter + SqlCommandBuilder -> DataSet -> 
  convert blob to required text format -> DataSet -> DataGridView

This would require for me to only provide conversion between DataSets in both Directions so that everything works automaticly. That comes down on two functions converting BLOB <-> string

Where can i put this functions in first architecture, as I don't want 2 DataSets. I need to place them in some handler or somewhere between two steps not to interfere with automatic binding, and that Update of data back to SqlDatabase still works.

A: 

Use varbinary. Easier to work with, BLOBs always been problematic to work with.

Voulnet
This should be generic architecture for editing any database where user provides functions and information how to transform supported binary data. Example is that user provides delegates for encryption and decryption of some columns. I don't see how would varbinary be better than image type? And if it is better, I have no knowledge and control about source database. My job is to implant this delegates and information about target data type on right place so that other parts of process are intact and simple.
watbywbarif
Ok, if .NET will create DataGridViewTextBoxCell instead of DataGridViewImageCell for varbinary it helps because I can include delegates in DataGridView CellFormating event, but i would like to handle other types and still use automatic binding ;)
watbywbarif
Well, I'm not THAT much experienced in Databinding, so I'm afraid I can only point you to the direction of varbinary, from there you can search for it OR ask another varbinary-related question =)
Voulnet