Hello, I did a simple conversion from string to bytes to store into varbinary column. This is a test for my assignment. Now I want to view the bytes store in the sql to its former string. I cannot find any examples on this as I only see examples for images, is there any suggestions?
This is my code:
protected void Page_Load(object sender, EventArgs e)
{
bindgrid();
Encoding enc = Encoding.ASCII;
byte[] myByteArray = enc.GetBytes("a text string");
string myString = enc.GetString(myByteArray);
string SqlString = "Insert Into test (Byte) Values (@Byte)";
using (con = new SqlConnection(connString))
{
using (cmd = new SqlCommand(SqlString, con))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("Byte", myByteArray);
con.Open();
cmd.ExecuteNonQuery();
con. ...
Go to the complete details ...