带参数的存储过程里不能包含动态SQL吗?
SQL语句:
select @sSQL = 'Insert Into #Temp_InCome ' +
' (fConNo,fWorkNo,fWorkDate,fCustNo,fDeptNo,fRouteName,fcontainertypename,fcabinnoa,fcontainernoa,fBillStatus,fnotecon)' +
' select fConNo,fWorkNo,fWorkDate,fCustNo,fDeptNo,fRouteName,fcontainertypename,fcabinnoa,fcontainernoa,fBillStatus,fnotecon ' +
' From t_Consign where ' + @Swhere
exec(@sSQL)
asp.Net
dim ConnectionString as new SQLconnection(configurationSettings.appSettings("SQLConStr"))
Dim testCMD As SqlCommand = New SqlCommand ("sp_Query_InCome", ConnectionString)
testCMD.CommandType = CommandType.StoredProcedure
Dim sWhere As SqlParameter = testCMD.Parameters.Add("@sWhere", SqlDbType.VarChar, 11)
sWhere.Direction = ParameterDirection.Input
sWhere.Value = ls_WhereSQL
ConnectionString.Open()
Dim myReader As SqlDataReader = testCMD.ExecuteReader()
执行出错!