企业库dbcommand addoutparameter与asp.net中的存储过程c#

时间:2013-11-26 04:17:01

标签: c# mysql asp.net output enterprise

我的存储过程:

CREATE DEFINER = AS0058 @ %程序getName(在INT中,INOUT ename VARCHAR(50)) 开始 从emp中选择fname进入ename,其中empid = eid; END

使用企业库的ASP.NET C#程序:

DbProviderFactory dbProviderFactory = DbProviderFactories.GetFactory(“System.Data.Odbc”);             string connect =“Dsn = emp; uid = AS0058; pwd = best @ 123”;             数据库db = new GenericDatabase(connect,dbProviderFactory);           DbCommand cmd = db.GetStoredProcCommand(“{call getName(?,?)}”);             db.AddInParameter(cmd,“empid”,DbType.Int32,2);             db.AddOutParameter(CMD,其中 “fname”,DbType.String,45);             //db.DiscoverParameters(cmd);             db.ExecuteScalar(cmd); //在这个地方抛出错误:OUT或INOUT伪造的变量触发器             string results = Convert.ToString(db.GetParameterValue(cmd,“fname”));              MessageBox.Show(结果);

请建议我一个解决方案:

0 个答案:

没有答案