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. program

program

Scheduled Pinned Locked Moved C#
helpquestioncsharpdatabasecom
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
    mhmo
    wrote on last edited by
    #1

    Hi all I am writting a C# program that reads lines from a file. And then store each line in one record in more than one field. But at the middle of the proccessing a message said that "v\cant open more tables" here is the pic: http://www.javadevs.com/problem.bmp[^] copy the link and paste it in the browser... And here is my code: for (int i = 1; i<= Int32.Parse(numNumber.Value.ToString().Trim()); i++ ) { string cha = answers.Substring(i-1,1); string anCommand = "UPDATE information SET " + i + "='" + cha + "' WHERE id = '" + id+ "';"; try { com = new OdbcCommand(anCommand, dbConn); com.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show( anCommand + "\r\nInserting answers\r\n" + ex.ToString()); stsGrade.Text = "Error!..."; return; } finally { } } It worked for the first 3 lines, but in the fourth line the problem appeared!! All the lines has the same structure. I am using MS Access database. What is the problem?

    M J 2 Replies Last reply
    0
    • M mhmo

      Hi all I am writting a C# program that reads lines from a file. And then store each line in one record in more than one field. But at the middle of the proccessing a message said that "v\cant open more tables" here is the pic: http://www.javadevs.com/problem.bmp[^] copy the link and paste it in the browser... And here is my code: for (int i = 1; i<= Int32.Parse(numNumber.Value.ToString().Trim()); i++ ) { string cha = answers.Substring(i-1,1); string anCommand = "UPDATE information SET " + i + "='" + cha + "' WHERE id = '" + id+ "';"; try { com = new OdbcCommand(anCommand, dbConn); com.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show( anCommand + "\r\nInserting answers\r\n" + ex.ToString()); stsGrade.Text = "Error!..."; return; } finally { } } It worked for the first 3 lines, but in the fourth line the problem appeared!! All the lines has the same structure. I am using MS Access database. What is the problem?

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Perhaps calling Dispose on your OdbcCommand object after ExecuteNonQuery() will help... mav

      M 1 Reply Last reply
      0
      • M mhmo

        Hi all I am writting a C# program that reads lines from a file. And then store each line in one record in more than one field. But at the middle of the proccessing a message said that "v\cant open more tables" here is the pic: http://www.javadevs.com/problem.bmp[^] copy the link and paste it in the browser... And here is my code: for (int i = 1; i<= Int32.Parse(numNumber.Value.ToString().Trim()); i++ ) { string cha = answers.Substring(i-1,1); string anCommand = "UPDATE information SET " + i + "='" + cha + "' WHERE id = '" + id+ "';"; try { com = new OdbcCommand(anCommand, dbConn); com.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show( anCommand + "\r\nInserting answers\r\n" + ex.ToString()); stsGrade.Text = "Error!..."; return; } finally { } } It worked for the first 3 lines, but in the fourth line the problem appeared!! All the lines has the same structure. I am using MS Access database. What is the problem?

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        I hope for your sake no id is never 'DELETE FROM Information

        1 Reply Last reply
        0
        • M mav northwind

          Perhaps calling Dispose on your OdbcCommand object after ExecuteNonQuery() will help... mav

          M Offline
          M Offline
          mhmo
          wrote on last edited by
          #4

          You are write :) Thank u very much. I appreciated ur help :)

          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