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. connection string for OLEDB2 provider..using C#

connection string for OLEDB2 provider..using C#

Scheduled Pinned Locked Moved C#
csharpdatabasesecurityhelplearning
4 Posts 2 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.
  • I Offline
    I Offline
    icesha
    wrote on last edited by
    #1

    please.. i need a sample... or please check if somethings wrong in this program..its not saving..and i think the connection string is not valid but it doesnt build any errors until you save in the database. OleDbConnection connect=new OleDbConnection(); connect.ConnectionString="PROVIDER=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI"; connect.Open(); OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect); cmd_save.ExecuteNonQuery(); connect.Close(); thanks for the help..

    S 1 Reply Last reply
    0
    • I icesha

      please.. i need a sample... or please check if somethings wrong in this program..its not saving..and i think the connection string is not valid but it doesnt build any errors until you save in the database. OleDbConnection connect=new OleDbConnection(); connect.ConnectionString="PROVIDER=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI"; connect.Open(); OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect); cmd_save.ExecuteNonQuery(); connect.Close(); thanks for the help..

      S Offline
      S Offline
      Snews
      wrote on last edited by
      #2

      Check this to get some help with the connection string. http://www.carlprothman.net/Default.aspx?tabid=86#OLEDBManagedProvider But it sure seems odd that the error isn't raised when the Open() method is called. Must be the INSERT statement that's wrong. I don't know for sure if it's ok to write the ending ) of the data declaration without any space before VALUES( ... ) declaration. I can also recommend you to start using SqlParameter to get a safer and smoother SQL handling. Take a look here for a quick example: http://www.samspublishing.com/articles/article.asp?p=27640&seqNum=6&rl=1 Hope it helps some

      I 1 Reply Last reply
      0
      • S Snews

        Check this to get some help with the connection string. http://www.carlprothman.net/Default.aspx?tabid=86#OLEDBManagedProvider But it sure seems odd that the error isn't raised when the Open() method is called. Must be the INSERT statement that's wrong. I don't know for sure if it's ok to write the ending ) of the data declaration without any space before VALUES( ... ) declaration. I can also recommend you to start using SqlParameter to get a safer and smoother SQL handling. Take a look here for a quick example: http://www.samspublishing.com/articles/article.asp?p=27640&seqNum=6&rl=1 Hope it helps some

        I Offline
        I Offline
        icesha
        wrote on last edited by
        #3

        thanks.. its now running. But the problem is that i cant save data on the database. The exception is that the provider=DB2OLEDB is not available in the local machine. it highlights the statement where i insert values. thanks.

        I 1 Reply Last reply
        0
        • I icesha

          thanks.. its now running. But the problem is that i cant save data on the database. The exception is that the provider=DB2OLEDB is not available in the local machine. it highlights the statement where i insert values. thanks.

          I Offline
          I Offline
          icesha
          wrote on last edited by
          #4

          and also the site that you give is not valid.. thanks..

          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