Я видел здесь много сообщений о переполнении стека с той же проблемой, которая упоминается в заголовке. Но все же моя проблема не решена из-за этого, поэтому не отмечайте ее как дублирующую прямо сейчас, поскольку мне действительно нужно понять причину и найти решение для этого. У меня есть процедура, которая отлично работает в рабочей среде, но не при вызове из C#.
Вот мой код c#:
public List<object> GetScheduleTest(string building,int sem, int week, int day, string userid)
{
List<object> idata = new List<object>();
DataTable dt = new DataTable();
using(MySqlConnection cn = new MySqlConnection(constring))
{
try
{
if (cn.State != ConnectionState.Open) { cn.Open(); }
using (MySqlCommand cmd = new MySqlCommand("GetScheduleTest", cn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("build", building);
cmd.Parameters.AddWithValue("sem", sem);
cmd.Parameters.AddWithValue("weekno", week);
cmd.Parameters.AddWithValue("daynum", day);
cmd.Parameters.AddWithValue("userid", userid);
MySqlDataAdapter mySqlData = new MySqlDataAdapter(cmd);
mySqlData.Fill(dt);
}
idata.Add(dt);
}
catch(Exception ex)
{
}
}
return idata;
}
Вот процедура mysql. Это немного великовато.
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetScheduleTest`(build varchar(45), weekno int, sem int,daynum int, userid varchar(45))
BEGIN
set @uid=userid;
set @semno = sem;
set @dayno = daynum;
set @daynumreserve = daynum+1;
set @weeknum = weekno;
set @building = build;
SET @sql := CONCAT('
create or replace view View_resultScheduleDayWeek as
SELECT sc.classname, ifnull(concat(case when section = 11 then coursename end),'' '') AS `section11`,
ifnull(concat(case when section = 5 then coursename end),'' '') AS `section5`,
ifnull(concat(case when section = 6 then coursename end),'' '') AS `section6`,
ifnull(concat(case when section = 7 then coursename end),'' '') AS `section7`,
ifnull(concat(case when section = 9 then coursename end),'' '') AS `section9` ,
ifnull(concat(case when section = 1 then coursename end),'' '') AS `section1`,
ifnull(concat(case when section = 2 then coursename end),'' '') AS `section2`,
ifnull(concat(case when section = 3 then coursename end),'' '') AS `section3`,
ifnull(concat(case when section = 4 then coursename end),'' '') AS `section4` ,
ifnull(concat(case when section = 8 then coursename end),'' '') AS `section8`,
ifnull(concat(case when section = 10 then coursename end),'' '') AS `section10`,
ifnull(concat(case when section = 12 then coursename end),'' '') AS `section12`
FROM schedule sc where weekStart<=',@weeknum,' and weekend >=',@weeknum,' and
sc.classname in (select classname from classdetails where teachingBuilding=''',@building,''' and classname in
(select classid from userlocationaccess where userserialnum =(select serialno from userdetails where loginid= ''',@uid,''')))
and Sem =',@semno,' and dayno =',@dayno,' GROUP BY section,sc.classname
union
SELECT classroom as classname, ifnull(concat(case when section = 11 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section11`,
ifnull(concat(case when section = 5 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section5`,
ifnull(concat(case when section = 6 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section6`,
ifnull(concat(case when section = 7 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section7`,
ifnull(concat(case when section = 9 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section9` ,
ifnull(concat(case when section = 1 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section1`,
ifnull(concat(case when section = 2 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section2`,
ifnull(concat(case when section = 3 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section3`,
ifnull(concat(case when section = 4 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section4` ,
ifnull(concat(case when section = 8 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section8`,
ifnull(concat(case when section = 10 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section10`,
ifnull(concat(case when section = 12 then concat( purpose,'':reserve:'',Status) end),'' '') AS `section12`
FROM schedulereserve where classroom in (select classname from classdetails where teachingbuilding=''',@building,''' and classname in
(select classid from userlocationaccess where userserialnum =(select serialno from userdetails where loginid= ''',@uid,''')))
and week =',@weeknum,' and Status !=''Rejected'' and semester =',@semno,' and weekday(date) =',@daynumreserve,' GROUP BY section,classroom
union
SELECT newclass as classname, ifnull(concat(case when newsection = 11 then concat( courseid ,'':transfer:'',currentstatus) end),'' '') AS `section11`,
ifnull(concat(case when newsection = 5 then concat( courseid ,'':transfer:'',currentstatus) end),'' '') AS `section5`,
ifnull(concat(case when newsection = 6 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section6`,
ifnull(concat(case when newsection = 7 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section7`,
ifnull(concat(case when newsection = 9 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section9` ,
ifnull(concat(case when newsection = 1 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section1`,
ifnull(concat(case when newsection = 2 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section2`,
ifnull(concat(case when newsection = 3 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section3`,
ifnull(concat(case when newsection = 4 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section4` ,
ifnull(concat(case when newsection = 8 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section8`,
ifnull(concat(case when newsection = 10 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section10`,
ifnull(concat(case when newsection = 12 then concat(courseid ,'':transfer:'',currentstatus) end),'' '') AS `section12`
FROM scheduletransfer where newweek<=',@weeknum,' and newweek >=',@weeknum,' and newclass in
(select classname from classdetails where teachingbuilding=''',@building,''' and classname in
(select classid from userlocationaccess where userserialnum =(select serialno from userdetails where loginid= ''',@uid,'''))) and
idref in (select id from schedule where sem=',@semno,') and newday =',@dayno,' GROUP BY newsection,newclass');
PREPARE stmt FROM @sql;
EXECUTE stmt;
select row_number() OVER() AS RowNumber , classname, max(section1) as section1, max(section2) as section2,
max(section3)as section3,
max(section4)as section4,
max(section5)as section5,
max(section6)as section6,max(section7)as section7,
max(section8)as section8,
max(section9)as section9,max(section10)as section10,
max(section11)as section11,
max(section12)as section12 from View_resultScheduleDayWeek group by classname;
END
Они работали до вчерашнего дня без каких-либо проблем. Я попытался внести некоторые изменения в процедуру подкачки. Это также отлично работало на стороне базы данных. Но однажды я внес изменения, которые включили выходной параметр на стороне c#. Эта процедура перестала давать результаты с c#. и теперь его более ранняя версия, которая указана выше, также не работает через c#. Я пробовал все возможные решения из разных сообщений, но ничего не работает. и поскольку нет никаких исключений, я не понимаю причины. Пожалуйста, предложите что-нибудь. Дайте мне знать, если вам понадобится дополнительная информация. Спасибо