您好参数的错误 [英] hi igot error in parameter

查看:61
本文介绍了您好参数的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面出现了错误

hi i got error in below

public static DataSet getAllStatesByCountryID(int CountryID)
{
SqlParameter parameter = new SqlParameter("@CountryID", SqlDbType.Int)
{
Value = CountryID
};
return SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure,
"spGetAllStatesByCountryID", new SqlParameter[] { parameter });
}


其显示错误;; CountryID


its showing error in ;excepted near the CountryID

推荐答案

Hi,
附近除外 试试这个:
Hi,
Try this:
public static DataSet getAllStatesByCountryID(int CountryID)
{
    SqlParameter[] parameter = new SqlParameter[]
    {
        new SqlParameter("@CountryID", CountryID)
    };
    return SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure,
    "spGetAllStatesByCountryID",  parameter);
}




--Amit




--Amit


public static DataSet getAllStatesByCountryID(int CountryID)
{
SqlParameter parameter = new SqlParameter("@CountryID", SqlDbType.Int)
{
Value = CountryID;// You have put <code>;</code> in wrong place.Please check this line
}
return SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure,
"spGetAllStatesByCountryID", new SqlParameter[] { parameter });
}


您需要在语句末尾添加分号
You need to add a semicolon to the end of your statement
SqlParameter parameter = new SqlParameter("@CountryID", SqlDbType.Int)
{
   Value = CountryID;
}


这篇关于您好参数的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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