我创建了一个存储过程 代码如下:
create proc GetField
@SourceID int //整型
as
select FieldID, FieldName,SourceID from [Projection.Field] where SourceID=@SourceID
go调用调用参数的过程中出现如下错误:
SqlDataAdapter sda = new SqlDataAdapter("GetField", con);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
sda.SelectCommand.Parameters.Add("@SourceID",SqlDbType.Int);
sda.SelectCommand.Parameters["@SourceID"].Value=this.Projection_Source.SelectedValue;
DataSet ds=new DataSet();
sda.Fill(ds);
////Failed to convert parameter value from a String to a Int32.
this.Projection_Source--是一个DropDownList控件大虾们帮帮忙呀~~
create proc GetField
@SourceID int //整型
as
select FieldID, FieldName,SourceID from [Projection.Field] where SourceID=@SourceID
go调用调用参数的过程中出现如下错误:
SqlDataAdapter sda = new SqlDataAdapter("GetField", con);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
sda.SelectCommand.Parameters.Add("@SourceID",SqlDbType.Int);
sda.SelectCommand.Parameters["@SourceID"].Value=this.Projection_Source.SelectedValue;
DataSet ds=new DataSet();
sda.Fill(ds);
////Failed to convert parameter value from a String to a Int32.
this.Projection_Source--是一个DropDownList控件大虾们帮帮忙呀~~
sda.SelectCommand.Parameters["@SourceID"].Value = int.Parse(this.Projection_Source.SelectedItem.Value);
这行提示如下错误:
Input string was not in a correct format.
这个应该怎么解决呢??