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