开发者

Why even the conversion from byte to string is showing system.string[]

开发者 https://www.devze.com 2023-02-26 14:10 出处:网络
In my data base i save the data of File_Data as long blob I write the code as follows but i am unable to get the original text

In my data base i save the data of File_Data as long blob

I write the code as follows but i am unable to get the original text

string deleteSQL = "Select File_Data from tblachmaster WHERE Id IN (" + gvIDs.Substring(0, gvIDs.LastIndexOf(",")) + ")";
        MySqlCommand cmd = new MySqlCommand(deleteSQL);
        cmd.Parameters.Add开发者_JAVA百科("@_id", SqlDbType.Int).Value = gvIDs;
        DataTable dt = GetData1(cmd);
        if (dt != null)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Byte[] bytes = (Byte[])dt.Rows[i]["File_Data"];
                string text = Encoding.UTF8.GetString(bytes);
                string[] lines = Regex.Split(text, "\r\n");
                string strLine = convertArrayToString(lines);
        }
}

Unable to get the conversion can any one help me


Check whether you are converting your inserted blob data is converted to bytes and inserted or not. Check for your column in MySQL editor by opening it using Open Value in editor select Text if you are able to view your data there then it is OK if not means convert the data to bytes before inserting to your table this will solve the issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消