I am facing a problem with stored procedure in case of "OdbcConnection ". The code is given below:-
Expand|Select|Wrap|Line Numbers
- OdbcConnection conn = new OdbcConnection(connstring);
- conn.Open();
- OdbcCommand cmd = new OdbcCommand("sp_comboIDChange", conn);
- cmd.CommandType = CommandType.StoredProcedure;
- OdbcParameter parameter1 = new OdbcParameter();
- parameter1.OdbcType = OdbcType.VarChar;
- parameter1.ParameterName = "@Branch_Code";
- parameter1.Value = Combo;
- cmd.Parameters.Add(parameter1);
- OdbcDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- s = dr[0].ToString();
- }
- conn.Dispose();
[SCRIPT]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFI ER ON
GO
ALTER PROCEDURE [dbo].[sp_comboIDChang e]
@Branch_Code bigint
AS
BEGIN
select Branch_Name from TBranch_Entry where Branch_Code=@Br anch_Code
END
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFI ER OFF
GO
[/SCRIPT]
The Error is:-
ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure or Function 'sp_comboIDChan ge' expects parameter '@Branch_Code', which was not supplied.
But if i use "SqlConnect ion" in spite of "OdbcConnection " then the is not occurred. What is the problem in "OdbcConnection "? Please, anyone inform me.
Your regards
Miraz