OracleClient
-
I am facing problem to connect oracle server with predefined datasource. Can anyone please tell me how can i create a connection with (ip address) , (orcale instance), (username) and (password). Please also provide me few lines of code, to update a table with using parameters. I attemted sql like "update set = ? where pk = ?", but it did not work at all. love2code
-
I am facing problem to connect oracle server with predefined datasource. Can anyone please tell me how can i create a connection with (ip address) , (orcale instance), (username) and (password). Please also provide me few lines of code, to update a table with using parameters. I attemted sql like "update set = ? where pk = ?", but it did not work at all. love2code
I really did work very little with Oracle for one project, but if I remember correctly, you need to install some client software, and it's in that software that you set up the connection to the server. In you .NET code (using Oracle Data Provider) your connection string basically looks like this:
Data Source=schema name;User Id=user name;Password=password"
As you can see, no server information is there. As for the parameter question, its something like this:
string sql = "UPDATE Table SET Field1 = :p_Field1 WHERE Field2 = :p_Field2"; // Note the colons to specify parameters OracleCommand cmd = new OracleCommand(sql, conn); cmd.Parameters.Add("p_Field1", someValue); // Note that there is no colon cmd.Parameters.Add("p_Field2", someOtherValue); cmd.ExecuteNonQuery();
I hope this helps a little. Good luck! -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
I really did work very little with Oracle for one project, but if I remember correctly, you need to install some client software, and it's in that software that you set up the connection to the server. In you .NET code (using Oracle Data Provider) your connection string basically looks like this:
Data Source=schema name;User Id=user name;Password=password"
As you can see, no server information is there. As for the parameter question, its something like this:
string sql = "UPDATE Table SET Field1 = :p_Field1 WHERE Field2 = :p_Field2"; // Note the colons to specify parameters OracleCommand cmd = new OracleCommand(sql, conn); cmd.Parameters.Add("p_Field1", someValue); // Note that there is no colon cmd.Parameters.Add("p_Field2", someOtherValue); cmd.ExecuteNonQuery();
I hope this helps a little. Good luck! -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
Thanks, Luis My parameters problem has been solved. But think those situation where my client machine has .net installted and oracle net client installed. When i run my program from that machine, it continues searching Oracle Server. My program does not know the Orcale [alias] or [data source] configured at that machine. Please provide me such Microsoft Solution. Thanks again. PK Biswas, India. love2code