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. please check if the DB2OLEDB connection string is correct.

please check if the DB2OLEDB connection string is correct.

Scheduled Pinned Locked Moved C#
databasesysadminsecurityxmlquestion
3 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

    oConn.Open = "Provider=DB2OLEDB;" & _ "Network Transport Library=TCPIP;" & _ "Network Address=xxx.xxx.xxx.xxx;" & _ "Initial Catalog=MyCatalog;" & _ "Package Collection=MyPackageCollection;" & _ "Default Schema=MySchema;" & _ "User ID=MyUsername;" & _ "Password=MyPassword" this is the connection string i got from a site. How will apply it in my program: OleDbConnection connect=new OleDbConnection(); connect.ConnectionString="Provider=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI,default schema=jefoy"; 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(); will i place it as it is or will i change the schemas and the other items? its not working. Maybe somethings wrong. Thanks...

    B 1 Reply Last reply
    0
    • I icesha

      oConn.Open = "Provider=DB2OLEDB;" & _ "Network Transport Library=TCPIP;" & _ "Network Address=xxx.xxx.xxx.xxx;" & _ "Initial Catalog=MyCatalog;" & _ "Package Collection=MyPackageCollection;" & _ "Default Schema=MySchema;" & _ "User ID=MyUsername;" & _ "Password=MyPassword" this is the connection string i got from a site. How will apply it in my program: OleDbConnection connect=new OleDbConnection(); connect.ConnectionString="Provider=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI,default schema=jefoy"; 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(); will i place it as it is or will i change the schemas and the other items? its not working. Maybe somethings wrong. Thanks...

      B Offline
      B Offline
      Binod K
      wrote on last edited by
      #2

      Hi, No need to write Default Schema. Eithr u use Upper haft part or lower half part. Give User id and Password in lower part of connection string. Then Take a Integer vriable as int intRow=cmd_save.ExecuteNonQuery(); if(intRow>0) { "Record Updated" } Note: ExecuteNonQuery returns number of rows affected. Binod K.

      I 1 Reply Last reply
      0
      • B Binod K

        Hi, No need to write Default Schema. Eithr u use Upper haft part or lower half part. Give User id and Password in lower part of connection string. Then Take a Integer vriable as int intRow=cmd_save.ExecuteNonQuery(); if(intRow>0) { "Record Updated" } Note: ExecuteNonQuery returns number of rows affected. Binod K.

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

        OleDbConnection connect=new OleDbConnection(); connect.ConnectionString="Provider=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI,user id=db2admin;password=eugene09"; connect.Open(); OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect); int intRow=cmd_save.ExecuteNonQuery(); if(intRow>0) { MessageBox.Show("Record added"); } connect.Close(); this is a program i created adding a record in the database but their is no error but an exception, saying " DB2OLEDB is not existing in the local machine." i think the problem is in the insert command. thanks for all the 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