How to read .lbl file

2020-05-08 07:27发布

I want to read my .lbl file and store its data into a database column. So, whenever the user wants to modify it, they may create a new .lbl file from the Database.

I have converted my .lbl data into Binary by using the snippet shown below:

byte[] fileBytes = File.ReadAllBytes("D:\\Work\\PNS\\TEST.lbl");
StringBuilder sb = new StringBuilder();

foreach (byte b in fileBytes)
{
    sb.Append(Convert.ToString(b, 2).PadLeft(8, '0'));
    string bindata = sb.ToString();  // store this variable value in DataBase Column
}

File.WriteAllText("D:\\Work\\PNS\\TESTnew.lbl", sb.ToString());

But, When I Open a new file I get Error like this

Unable to open label, the file or folder is not accessible, does not exist, or is already opened by another user. Try Opening the label with 'read-only' flag set!

Kindly Help me to figure out this problem

0条回答
登录 后发表回答