I downloaded the OracleHelper.cs & I use VisualStudio 2008,
I'm suppose to pass values to a stored procedure which accepts 2 parameters
When i pass from codebehind it says,
Cannot convert from 'int' to 'System.Data.OracleClient.OracleParameter'
Cannot convert from 'string' to 'System.Data.OracleClient.OracleParameter'
The best overloaded method match for 'DataWrapper.ExecuteNonQuery(string, System.Data.CommandType, string, params System.Data.OracleClient.OracleParameter[])' has some invalid arguments
As you can see it is expecting an array of OracleParameter objects and what you are passing are simply the values. Instead pass objects of OracleParameter objects so replace each value you are passing with the parameter object.
Therefore your code should be similar to
OracleHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "sample", new OracleParameter(parametername, Int32.Parse(TextBox1.Text)), new OracleParameter(parametername, TextBox2.Text));
Member
91 Points
85 Posts
Cannot convert from 'int' to 'System.Data.OracleClient.OracleParameter' - Problem with OracleHelp...
Sep 07, 2010 06:52 AM|S.Silambarasan|LINK
Hi
I downloaded the OracleHelper.cs & I use VisualStudio 2008,
I'm suppose to pass values to a stored procedure which accepts 2 parameters
When i pass from codebehind it says,
I'm posting mycode,
Using STORED PROCEDURE,
Plz help !
______________________________________
If possible, tell me a solution for this error too !
http://forums.asp.net/t/1598804.aspx
Member
160 Points
71 Posts
Re: Cannot convert from 'int' to 'System.Data.OracleClient.OracleParameter' - Problem with Oracle...
Sep 07, 2010 07:04 AM|pankaj.ks|LINK
ExecuteNonQuery(string, System.Data.CommandType, string, params System.Data.OracleClient.OracleParameter[])
As you can see it is expecting an array of OracleParameter objects and what you are passing are simply the values. Instead pass objects of OracleParameter objects so replace each value you are passing with the parameter object.
Therefore your code should be similar to
OracleHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "sample", new OracleParameter(parametername, Int32.Parse(TextBox1.Text)), new OracleParameter(parametername, TextBox2.Text));
Member
91 Points
85 Posts
Cannot convert from 'int' to 'System.Data.OracleClient.OracleParameter' - Problem with OracleHelp...
Sep 07, 2010 08:35 AM|S.Silambarasan|LINK
Thanks a lot Pankaj,
It works fine...
Will u also tell me why isn't this working ???
DataWrapper.ExecuteNonQuery(connection, CommandType.Text, "Insert into sample values(id,name)",new OracleParameter("id",OracleType.Int32,Int32.Parse(TextBox1.Text)),new OracleParameter("name",TextBox2.Text.ToString()));
The error i get when executing the above line is,
ORA-01036: illegal variable name/number
List<OracleParameter> Oparams = new List<OracleParameter>();
Oparams.Add(new OracleParameter("@id", Int32.Parse(TextBox1.Text)));
Oparams.Add(new OracleParameter("@name", TextBox2.Text));
DataWrapper.ExecuteNonQuery(connection, CommandType.Text, "Insert into sample values(id,name)", Oparams);
Oparams.Clear();
I get the following error while building itself,
I DID'NT MARK AS ANSWER YET COZ I WANT U TO LOOK INTO THIS ISSUE TOO
I'll Mark as answer even if u dont guide me for the this issue !
Cheers Pal !