Hi,
Ii have a database (sql server 2008) and I am working with c# in visual studio 2010.
I want to establish a connection with my db. I have written a code for that as follows:
SqlConnection mySqlConnection = new SqlConnection
("Data Source=servername\\SQL2008; Initial Catalog=MyData;UID=MyID;PWD=mypassword;");
SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = "SELECT image_column FROM images_table ";
mySqlConnection.Open();
SqlDataReader productsSqlDataReader = mySqlCommand.ExecuteReader();
I do not know how to proceed further. I mean how to extract the column from the reader after executing the above statements? Also I need to go through the entire column row by row and convert each image to an IContent item. Do I have to write my own converter for this or is there any .NET class that does this already?
Heres the scenario. I have a table with like 20 columns one of which is the images_column. That column is the ONLY column that has images stored in as binary data. The remainig columns are usual integers (its size value) and strings (its name, location, etc) associated with that particular image. I hope that it is clear now.
Thanks.