我已存储Procerdure名称出席记录表
right:0
我想从vb.net 2010组合框值传递@trainid参数 vb.net代码是:
ALTER proc [dbo].[Attendancesheet] (@trainid nvarchar (max))
as
begin
declare @DyPQ as nvarchar (max)
declare @CN as nvarchar(max)
select @CN =ISNULL(@CN+',','')
+ QUOTENAME(lecturename)
FROM (SELECT DISTINCT lecturename FROM ATT where trainid=@trainid) as Lectures
--Print @CN
SET @DyPQ= N'
select * from
(
select (select trinsname from trains where trinsid=e.trinsid) as [TrainerNmae],
lecturename,
att_status
from att e where (trainid=@trainid))as p
pivot
(
max(Att_status) for lecturename in(' + @CN + '))as f'
execute (@DyPQ);
end
答案 0 :(得分:0)
您可以尝试以下代码:
Dim trainid As SqlParameter = cmd.Parameters.AddWithValue("@trainid", Me.cbotrainings.SelectedValue.ToString().Trim)