Click here to Skip to main content
15,921,212 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Please help. I get an mysql - error: parallelitätsverletzung beim update with the following code - I can'nt find the bug.

Coding:

C#
private byte[] convertPic(string fn)
{
    FileStream fs = new FileStream(fn, FileMode.Open, FileAccess.Read);
    byte[] data = new byte[fs.Length];
    fs.Read(data, 0, Convert.ToInt32(fs.Length));
    fs.Close();
    return data;
}

private void btn_Pic_Click(object sender, EventArgs e)
{
    panel1.Visible = true;
    MySqlDataAdapter dbpic = new MySqlDataAdapter("select * from pat_picture order by Patient_ID", DBC);
    DataSet spic = new DataSet();
    dbpic.Fill(spic);
    int cnt = 0;
    int err = 0;
    foreach (DataRow rp in spic.Tables[0].Rows)
    {
        MySqlCommandBuilder cmb = new MySqlCommandBuilder(dbpic);
        try
        {
            rp["BildDaten"] = convertPic(@"D:\asys\Pictures\" + rp["Datei"].ToString().TrimEnd(' '));             // BildDaten = longblob
            cnt++;
        }
        catch
        {
            err++;
            continue;
        }
    }
    MySqlCommandBuilder cmbp = new MySqlCommandBuilder(DBBef);
    try
    {
        dbpic.UpdateCommand = cmbp.GetUpdateCommand();
        dbpic.Update(spic);
        MessageBox.Show("Konvertiert: " + cnt.ToString() + ", Fehlerhafte Sätze: " + err.ToString());
    }
    catch (Exception ep)
    {
        MessageBox.Show(ep.Message);
    }
}


Thank you in advance
Your's MiKr41
Posted
Comments
[no name] 6-Apr-14 18:05pm    
And for those of us that do not speak Germanic languages?
ZurdoDev 6-Apr-14 21:55pm    
You need to provide the error in English since this is an English site. However, have you goolged the error?
Bernhard Hiller 7-Apr-14 2:40am    
"Concurrency violation" is the english term for "Parallelitätsverletzung".
Some more information: in which line? Full error message?

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