从例程中获取数据时出错 [英] getting error when fetching data from routine

查看:58
本文介绍了从例程中获取数据时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI
我正在使用以下代码调用存储过程,并且得到了错误在数据库中找不到的函数或例程,但是它在数据库中,并且当我重新启动解决方案pl时,它运行良好检查我的存储过程,并告诉我哪里出了错

HI
I am using the following code to call the stored procedure and I am getting the errror the The function or routine not found in the databasebut it is in the database and it works well when i restart my solution pl check my Stored procedures and tell me where i went wrong

public DataTable getPermanentAddress(string strAssID)
    {
        //strCon.Open();
        DataTable dtAddress = new DataTable();
        strCon = new MySqlConnection(strConnection);
        strCon.Open();
        MySqlCommand cmdPermanentAddress = strCon.CreateCommand();//new MySqlCommand("sp_getPermanentAddress", strCon);
        try
        {
            cmdPermanentAddress.CommandText = "sp_getPermanentAddress";
            MySqlDataAdapter daPermanentAddress = new MySqlDataAdapter(cmdPermanentAddress);
            daPermanentAddress.SelectCommand.Parameters.Add("@AssociateId",MySqlDbType.Int32).Value = strAssID.ToString().Trim();
            daPermanentAddress.SelectCommand.CommandType = CommandType.StoredProcedure;
            daPermanentAddress.Fill(dtAddress);
            return dtAddress;
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        finally
        {
            if (strCon.State == ConnectionState.Open)
            {
                cmdPermanentAddress.Dispose();
                strCon.Close();
                strCon.Dispose();
            }
        
        }
    }


我的例程:


My routine:

-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_getPermanentAddress`(In AssociateId integer)
BEGIN
select permanent_add from associate_details where associate_id = AssociateId;
END


请告诉问题出在哪里


Please tell where is the issue

推荐答案

CREATE DEFINER =`root` @`localhost`程序sp_getPermanentAddress`(以AssociateId整数表示) 开始 选择 persistent_add 来自 associate_details 其中 associate_id = AssociateId ; END
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_getPermanentAddress`(In AssociateId integer) BEGIN select permanent_add from associate_details where associate_id = AssociateId; END


请告诉问题出在哪里


Please tell where is the issue


这篇关于从例程中获取数据时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆