出現這個訊息
The return types for the following stored procedures could not be detected. Set the return type for each stored procedure in the Properties window.
參考這篇...
Error: Unknown Return Type, The return types for the following stored procedures could not be detected….(LINQ).
建議的二種方法都不喜歡.
最後只好手動修改dbml檔的 .designer.cs檔
原本wizard自已產出的code如下
[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.zspTest")]
public void zspTest([global::System.Data.Linq.Mapping.ParameterAttribute(DbType="SmallInt")] System.Nullable<short> param1,
[global::System.Data.Linq.Mapping.ParameterAttribute(DbType="SmallInt")] System.Nullable<short> param2,
[global::System.Data.Linq.Mapping.ParameterAttribute(DbType="Int")] ref System.Nullable<int> rtn)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), param1, param2, rtn);
rtn = ((System.Nullable<int>)(result.GetParameterValue(2)));
}
手動改成
[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.zspTest")]
public int zspTest([global::System.Data.Linq.Mapping.ParameterAttribute(DbType="SmallInt")] System.Nullable<short> param1,
[global::System.Data.Linq.Mapping.ParameterAttribute(DbType="SmallInt")] System.Nullable<short> param2,
[global::System.Data.Linq.Mapping.ParameterAttribute(DbType="Int")] ref System.Nullable<int> rtn)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), param1, param2, rtn);
rtn = ((System.Nullable<int>)(result.GetParameterValue(2)));
return ((int)(result.ReturnValue));
}
沒有留言:
張貼留言