查询执行期间发生SqlException:

时间:2014-10-21 15:43:35

标签: c# mysql asp.net

我正在尝试为现有的网络应用添加一些功能,新手在这里感谢您的帮助。我有点迷失在这里,经过库解决方案无法找到解决方案。

描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:AssistToolv2.SqlException:查询执行期间发生SqlException:

来源错误:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

堆栈跟踪:

[SqlException: SqlException occurred during query execution: ]
   AssistToolv2.SQLEngine.Query(String query) in C:\Users\Tokin\Desktop\AssistToolv2\AssistToolv2\Classes\SQLEngine.cs:156
   AssistToolv2.AssistRoundRobin.EE.Page_Load(Object sender, EventArgs e) in C:\Users\Tokin\Desktop\AssistToolv2\AssistToolv2\AssistRoundRobin\EE.aspx.cs:29
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048

代码

using System;
using System.Collections.Generic; 
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AssistToolv2.AssistRoundRobin
{
    public partial class EE : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable SMEs = new DataTable();
            if (UserUtils.AccessLevel(Context.User.Identity.Name) < 5)
                SMEs = SQLEngine.Query(string.Format("SELECT * FROM arr_SMEs WHERE ID={0}", UserUtils.AccessGroup(Context.User.Identity.Name))).Copy();
            else
                SMEs = SQLEngine.Query("SELECT * FROM arr_SMEs").Copy();

                foreach (DataRow SME in SMEs.Rows)
                {
                    Label SMEName = new Label();
                    SMEName.Font.Bold = true;
                    SMEName.Text = SME["Name"].ToString();
                    SMEPlaceHolder.Controls.Add(SMEName);

                    DataTable SMEEs = SQLEngine.Query("SELECT * FROM arr_SMEs WHERE ID=DataRow.SMEs");

                    DataTable DisplayData = new DataTable();
                    DisplayData.Columns.Add("Name");
                    DisplayData.Columns.Add("Skills");
                    DisplayData.Columns.Add("Count");

                    foreach (DataRow SMEE in SMEEs.Rows)
                    {
                        DataRow DisplayInfo = DisplayData.NewRow();
                        DisplayInfo["Name"] = SMEE["Name"];
                        DisplayInfo["Skills"] = string.Empty;
                        string[] eeskills = SMEE["Skills"].ToString().Split(';');

                        int count = 0;
                        foreach (string skill in eeskills)
                        {
                            if (count > 0)
                                DisplayInfo["Skills"] += ",";
                            DataTable skillName = SQLEngine.Query(string.Format("SELECT Name from arr_Skills WHERE SME={0}", SMEE["ID"].ToString())).Copy();
                            DisplayInfo["Skills"] += skillName.Rows[0] ["Name"].ToString();
                            count++;
                        }
                    }
                    GridView SMEHistory = new GridView();
                    SMEHistory.Width = Unit.Percentage(185.00);
                    SMEHistory.DataSource = DisplayData;
                    SMEHistory.DataBind();
                    SMEPlaceHolder.Controls.Add(SMEHistory);
                    LiteralControl linebreak = new LiteralControl("<br /><br />");
                    SMEPlaceHolder.Controls.Add(linebreak);

                }
        }

        protected void DetailsView_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
        {
            bool test_var = true;
        }

    }
}'

0 个答案:

没有答案