Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
byte[] byt = Convert.ToByte(ds1.Tables[0].Rows[0]["Doc"]);

Instead of Convert coming error like this ...

Cannot implicitly convert type 'byte' to 'byte[]'

Can any one solve this please...
Posted

byte[] bytes = System.Text.Encoding.ASCII.GetBytes(ds1.Tables[0].Rows[0]["Doc"].tostring());

try this :)
 
Share this answer
 
v2
Convert.ToByte converts a numeric string to a byte. You want an array of bytes intead.
Use
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(myString);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900