Applicatie Loopt vast bij database insert

Status
Niet open voor verdere reacties.

Redder1997

Nieuwe gebruiker
Lid geworden
13 aug 2013
Berichten
1
hoi allemaal,

ik ben redelijk nieuw in C# en ben wat aan het experimenteren. nu ben ik bezig met een formuliertje dat schrijft in de database.
mijn code:
Code:
  if (comboBoxLetsel.Text != "")
	        {
                System_DBTableAdapters.Klein_EHBOTableAdapter klein_ehbotableadapter = new System_DBTableAdapters.Klein_EHBOTableAdapter();

                string Voornaam;
                string Tussenvoegsel;
                string Achternaam;
                string Letsel;
                string Voorletters;
                string Leeftijdsgroep;
                string Lichaamsdeel;
                string Behandeling;
                string Opmerkingen;
                string Oorzaak;
                string Geslacht;

                if(textBoxVoornaam.Text != null)
                { Voornaam = textBoxVoornaam.Text; }
                else
                { Voornaam = null; }

                if (textBoxtussenvoegsel.Text != null)
                { Tussenvoegsel = textBoxtussenvoegsel.Text; }
                else
                { Tussenvoegsel = null; }

                if (textBoxAchternaam.Text != null)
                { Achternaam = textBoxAchternaam.Text; }
                else
                { Achternaam = null; }

                if (comboBoxLetsel.Text != null)
                { Letsel = comboBoxLetsel.Text; }
                else
                { Letsel = null; }

                if (comboBoxGeslacht.Text != null)
                { Geslacht = comboBoxGeslacht.Text; }
                else
                { Geslacht = null; }

                if (textBoxVoorletters.Text != null)
                { Voorletters = textBoxVoorletters.Text; }
                else
                { Voorletters = null; }

                if (comboBoxLeeftijdsgroep.Text != null)
                { Leeftijdsgroep = comboBoxLeeftijdsgroep.Text; }
                else
                { Leeftijdsgroep = null; }

                if (comboBoxLichaamsdeel.Text != null)
                { Lichaamsdeel = comboBoxLichaamsdeel.Text; }
                else
                { Lichaamsdeel = null; }

                if (textBoxBehandeling.Text != null)
                { Behandeling = textBoxBehandeling.Text; }
                else
                { Behandeling = null; }

                if (textBoxOpmerkingen.Text != null)
                { Opmerkingen = textBoxOpmerkingen.Text; }
                else
                { Opmerkingen = null; }

                if (textBoxOorzaak.Text != null)
                { Oorzaak = textBoxOorzaak.Text; }
                else
                { Oorzaak = null; }

                klein_ehbotableadapter.Insert(Voornaam, Tussenvoegsel, Achternaam, Voorletters, Leeftijdsgroep, Letsel, Lichaamsdeel, Behandeling, Opmerkingen, Geslacht, Oorzaak);
                Close();
            }  else 
            {
                if (labelLetsel.ForeColor != System.Drawing.Color.Red)
                {
                    labelLetsel.ForeColor = System.Drawing.Color.Red;
                }
            }
      }
Iedere keer dat ik iets in de database probeer te schrijven loopt mijn hele applicatie vast.

kan iemand mij helpen?
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan