Error storing byte in mysql db

0

I am trying to store what I get in db mysql, but this is giving this error I believe it is type of column error:

26/02/2018 09:25:14 User connected
26/02/2018 09:25:14 Login : Skell
26/02/2018 09:25:14 Error: System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo info)
   at System.Convert.ToByte(String value)
   at libcomservice.Game.inventory.GetInventoryInfo(Session PLAYER) in D:\SkelletonX\GC\GC IV GC Nexus 2018\GameServer\Server\Request\Tables\Inventory.cs:line 101

line 101 of my code:

RequiredLevel = Convert.ToByte(DBAcess_0.Tables[0].Rows[i]["RequiredLevel"].ToString()), //?

In my table there is a column 'RequiredLevel' the type of it I put as blob, but still the error. How can I resolve?

    
asked by anonymous 26.02.2018 / 13:36

1 answer

1

Try using Encoding.GetBytes()

byte[] bytes = Encoding.ASCII.GetBytes(DBAcess_0.Tables[0].Rows[i]["RequiredLevel"].ToString());

In this answer you can see an example of using Encoding , converting to byte[] and back to string .

    
26.02.2018 / 13:43