Hi i am assigning binary value from sqltable to byte array
The error i am getting is

Cannot implicitly convert type 'System.Data.DataColumn' to 'byte[]' 

Byte[] bytes = (Byte[])ds.Tables["Photo_Det"].Columns["Photos"]);

Recommended Answers

All 2 Replies

try

Convert.ToBYte(ds.Tables["Photo_Det"].Columns["Photos"]))

it may work

Hi i am assigning binary value from sqltable to byte array
The error i am getting is
Cannot implicitly convert type 'System.Data.DataColumn' to 'byte

You are saying that you assign binary value from sqltable to byte array.

But ds.Tables["Photo_Det"].Columns["Photos"] will return an object of type 'DataColumn' and your are trying to convert it into array of unsigned integers (byte).

This is absolutely wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.