我使用C#调用存储过程并从数据表填充它,但我做错了什么。
  
  
   我的存储过程:
  
  CREATE PROCEDURE [dbo].[getStationInfo]
    @stationList AS dbo.udtableStationCode READONLY
AS  
BEGIN
    SELECT * 
    FROM stations
    WHERE StationCode IN (SELECT * FROM @stationList) 
END 
  
  
  CREATE TYPE [dbo].[udtableStationCode] 
     AS TABLE (StationCode NVARCHAR(50))
  
  
      using (SqlConnection con = new SqlConnection(strConn))
    {
        con.Open();
        using (SqlCommand cmd = new SqlCommand("getStationInfo", con))
        {
            using (SqlDataAdapter ada = new SqlDataAdapter(cmd))
            {
                using (DataTable dtStationsReturned = new DataTable())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Clear();
                    cmd.CommandText = "dbo.getStationInfo";
                    cmd.Parameters.AddWithValue("@stationList", dtStationCodes);
                    ada.Fill(dtStationsReturned);
                }
            }
        }
    }
  
   无论我尝试什么,当我的代码到达阿达,加油'行,我得到错误:
  
  
   
    过程“getStationInfo”没有名为“@stationList”的参数。
   
  
  
   
    getStationInfo
   
   显然有这个参数。有人能告诉我我做错了什么吗?谢谢你的帮助。
  
  
   编辑:我已经检查了
   
    dtStationCodes
   
  
  
   编辑:下面是我如何创建我的
   
   
   数据表:
  
  DataTable dtStationCodes = new DataTable();
dtStationCodes.Columns.Add("StationCode", typeof(String));