Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Any idea why this error appears (SEH Exception)

Any idea why this error appears (SEH Exception)

Scheduled Pinned Locked Moved C#
phphelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matjaz xyz
    wrote on last edited by
    #1

    I get http://www.postimage.org/image.php?v=Pq1N1qmr[^] <- this error on one of the computers. Dont know why. this is the code:

    try
    {
    label12.ForeColor = Color.Black;
    string dbConnComm = "INSERT INTO Vnosi ([Dostava],[Skatla],[Barkoda],[Oznaka],[Skener],[Operater],[Datum],[PosnetkiV3],[PosnetkiM3],[Opombe]) VALUES ("
    + cmbDostava.Text + ", "
    + cmbSkatla.Text + ", '"
    + cmbBarkoda.Text + "', '"
    + cmbEnota.Text + "', '"
    + cmbSkener.Text + "', '"
    + cmbOperater.Text + "', '"
    + cmbDatum.Text + "', "
    + txtVA3.Text + ", "
    + txtMA3.Text + ", '"
    + txtOpombe.Text + "')";

                SqlConnection dbConn = new SqlConnection(sqlConnection);
                dbConn.Open();
    
                SqlCommand dbComm = new SqlCommand(dbConnComm, dbConn);
                dbComm.ExecuteNonQuery();
                dbConn.Close();
                label12.Text = "Uspešno vnešeno";
            }
            catch(Exception ex)
            {
                label12.ForeColor = Color.Red;
                label12.Text = "Napaka pri vnosu";
    
                MessageBox.Show("Napaka: " + ex.ToString());
            }
    

    PC has framework 2.0 and 1.1

    M G 2 Replies Last reply
    0
    • M Matjaz xyz

      I get http://www.postimage.org/image.php?v=Pq1N1qmr[^] <- this error on one of the computers. Dont know why. this is the code:

      try
      {
      label12.ForeColor = Color.Black;
      string dbConnComm = "INSERT INTO Vnosi ([Dostava],[Skatla],[Barkoda],[Oznaka],[Skener],[Operater],[Datum],[PosnetkiV3],[PosnetkiM3],[Opombe]) VALUES ("
      + cmbDostava.Text + ", "
      + cmbSkatla.Text + ", '"
      + cmbBarkoda.Text + "', '"
      + cmbEnota.Text + "', '"
      + cmbSkener.Text + "', '"
      + cmbOperater.Text + "', '"
      + cmbDatum.Text + "', "
      + txtVA3.Text + ", "
      + txtMA3.Text + ", '"
      + txtOpombe.Text + "')";

                  SqlConnection dbConn = new SqlConnection(sqlConnection);
                  dbConn.Open();
      
                  SqlCommand dbComm = new SqlCommand(dbConnComm, dbConn);
                  dbComm.ExecuteNonQuery();
                  dbConn.Close();
                  label12.Text = "Uspešno vnešeno";
              }
              catch(Exception ex)
              {
                  label12.ForeColor = Color.Red;
                  label12.Text = "Napaka pri vnosu";
      
                  MessageBox.Show("Napaka: " + ex.ToString());
              }
      

      PC has framework 2.0 and 1.1

      M Offline
      M Offline
      Michael Bookatz
      wrote on last edited by
      #2

      A few quick question to help try find the answer. Have you tried the insert into the database directly and dose it work? What is the connection string you are using as it appears to be a connection issue? Can you connect to the database from that machine? Why are you using an insert? you should look at using a stored procedure as direct sql asks for an injection attack.

      1 Reply Last reply
      0
      • M Matjaz xyz

        I get http://www.postimage.org/image.php?v=Pq1N1qmr[^] <- this error on one of the computers. Dont know why. this is the code:

        try
        {
        label12.ForeColor = Color.Black;
        string dbConnComm = "INSERT INTO Vnosi ([Dostava],[Skatla],[Barkoda],[Oznaka],[Skener],[Operater],[Datum],[PosnetkiV3],[PosnetkiM3],[Opombe]) VALUES ("
        + cmbDostava.Text + ", "
        + cmbSkatla.Text + ", '"
        + cmbBarkoda.Text + "', '"
        + cmbEnota.Text + "', '"
        + cmbSkener.Text + "', '"
        + cmbOperater.Text + "', '"
        + cmbDatum.Text + "', "
        + txtVA3.Text + ", "
        + txtMA3.Text + ", '"
        + txtOpombe.Text + "')";

                    SqlConnection dbConn = new SqlConnection(sqlConnection);
                    dbConn.Open();
        
                    SqlCommand dbComm = new SqlCommand(dbConnComm, dbConn);
                    dbComm.ExecuteNonQuery();
                    dbConn.Close();
                    label12.Text = "Uspešno vnešeno";
                }
                catch(Exception ex)
                {
                    label12.ForeColor = Color.Red;
                    label12.Text = "Napaka pri vnosu";
        
                    MessageBox.Show("Napaka: " + ex.ToString());
                }
        

        PC has framework 2.0 and 1.1

        G Offline
        G Offline
        Giorgi Dalakishvili
        wrote on last edited by
        #3

        Don't use concatenation for building sql queries, it's dangerous. Read more here: Parametrized Queries VS String Concatenation[^]

        Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

        M 1 Reply Last reply
        0
        • G Giorgi Dalakishvili

          Don't use concatenation for building sql queries, it's dangerous. Read more here: Parametrized Queries VS String Concatenation[^]

          Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

          M Offline
          M Offline
          Matjaz xyz
          wrote on last edited by
          #4

          Yes Giorgi, thank you for your information on security about SQL injections. I just needed an anwser which was more than funny. The SQL Connection string was wrong. And its my bad that i forgot to mention that this error occurs only on computers which have low-access accounts in our domain. Now i've fixed this and it works. HopingToCode was right. I should check the connection string. Which i did today. Thank you both for your time.

          Regards, Matjaž

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups