Ramco Ramco

Ramco Ramco

  • 442
  • 3.4k
  • 517.5k

Could not find any table

Apr 29 2023 4:41 AM

Hi

  In Pivot if i do'nt insert into #temp then it workd properly otherwise it gives error 'Could not finf any table[0]

--set @query = 'select [BookId] [Book ID],BookTitle [Book],[ComboBookName],[CoreRPL],[Lexile],[NumberOfPages],[SessionPlanStatus],[ClosingStock], ' + @cols + '
	--INTO #temp from (select [BookID] ,BookTitle,[ComboBookName],[CoreRPL],[Lexile],[NumberOfPages],[SessionPlanStatus],Status,[ClosingStock],StudentName from #finalTable
	--where (('''+@BookID+'''=''0'' OR [BookId] IN('+ cast(@BookID as varchar(Max))+')))) x pivot
	--( Max(Status) for StudentName in (' + @cols + ')) piv order by BookTitle';
	print @query
	execute (@query)
DataTable BookPlanningResult = sQLUtility.GeBookPlanningRecommendation(vRpl, BookCollection, StudentCollection).Tables[0];
                if (BookPlanningResult != null)
                {
                    DataColumn Remarks = new DataColumn("Remarks", typeof(string));
                    BookPlanningResult.Columns.Add(Remarks);
                    DataColumn Dates = new DataColumn("Date", typeof(DateTime));
                    BookPlanningResult.Columns.Add(Dates);

                    grdPlanning.DataSource = BookPlanningResult;
                    grdPlanning.DataBind();
                }

Thanks


Answers (5)