Sqlクエリ通知を持つアプリケーションを作成していますが、問題が発生しました..システムは無限ループに入るループを続けています.使用したクエリはストアドプロシージャにあり、7を使用しました私のクエリのテーブル。クエリまたはアプリケーションの問題は何ですか? この感謝を解決するために親切に助けてください:)ここにコードを投稿しますこれは私が使用しているストアドプロシージャです
ALTER PROCEDURE [dbo].[INVENTORYLOG_VIEW]
AS
BEGIN
SELECT
ACCOUNT.Emp_Fname + ' ' + ACCOUNT.Emp_Lname AS [USERS],
INVENTORYLOG.ACTIVITYDATE AS [ACTIVITY DATE],
INVENTORYLOGDETAILS.ACTIVITYTIME AS [ACTIVITY TIME],
INVENTORYLOGDETAILS.LOG_ACTION AS [USER LOG],
CATEGORY.CATEGORY_NAME,
BRAND.Brand_Name AS BRAND,
PRODUCTDESCRIPTION.DESCRIPTION_TYPE,
COLOR.Color_Name AS [COLOR NAME],
SIZES.SIZE,
INVENTORY.QUANTITY_ON_HAND AS [CURRENT QTY],
INVENTORYLOGDETAILS.QUANTITY_LOG_ACTION AS [USER LOG QTY]
FROM
dbo.ACCOUNT INNER JOIN
dbo.INVENTORYLOG ON dbo.ACCOUNT.ACCOUNT_ID = dbo.INVENTORYLOG.Account_Id INNER JOIN
dbo.INVENTORYLOGDETAILS ON dbo.INVENTORYLOG.INVENTORYLOGID = dbo.INVENTORYLOGDETAILS.INVENTORYLOGID INNER JOIN
dbo.INVENTORY ON dbo.INVENTORYLOGDETAILS.INVENTORY_ID = dbo.INVENTORY.INVENTORY_ID INNER JOIN
dbo.PRODUCT_DTL ON dbo.INVENTORY.PRODUCT_DTL_ID = dbo.PRODUCT_DTL.PRODUCT_DTL_ID INNER JOIN
dbo.COLOR ON dbo.PRODUCT_DTL.COLOR_ID = dbo.COLOR.Color_Id INNER JOIN
dbo.BRAND ON dbo.PRODUCT_DTL.BRAND_ID = dbo.BRAND.Brand_Id INNER JOIN
dbo.CATEGORY ON dbo.PRODUCT_DTL.CATEGORY_ID = dbo.CATEGORY.CATEGORY_ID INNER JOIN
dbo.PRODUCTDESCRIPTION ON dbo.PRODUCT_DTL.DESCRIPTION_ID = dbo.PRODUCTDESCRIPTION.DESCRIPTION_ID INNER JOIN
dbo.SIZES ON dbo.PRODUCT_DTL.SIZE_ID = dbo.SIZES.SIZE_ID
END
そして、これは私のアプリケーションのコードです
string connect;
String connection;
private SqlConnection cons = null;
private SqlCommand command = null;
private DataSet myDataSet = null;
public Inventory_InventoryLog()
{
InitializeComponent();
this.gridView1.OptionsView.ColumnAutoWidth = false;
this.gridView1.ScrollStyle = ScrollStyleFlags.LiveHorzScroll | ScrollStyleFlags.LiveVertScroll;
ConnectionString access = new ConnectionString();
connection = access.AccessConnection(connect).ToString();
// Sql Notifications Automatic
EnoughPermission();
}
public bool EnoughPermission()
{
SqlClientPermission perm = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
try
{
perm.Demand();
MessageBox.Show(""+perm);
return true;
}
catch(System.Exception)
{
return false;
}
}
private void GetActivateData()
{
try
{
//String query = "SELECT [USER], [ACTIVITY DATE], [ACTIVITY TIME], [USER LOG], CATEGORY_NAME, Brand_Name, DESCRIPTION_TYPE, Color_Name, SIZE, [ CURRENT QTY], [USER LOG QTY] FROM INVENTORY_INVENTORY_LOG_DETAILS";
SqlDependency.Stop(connection);
SqlDependency.Start(connection);
if (cons == null)
cons = new SqlConnection(connection);
if (command == null)
{
command = new SqlCommand("dbo.INVENTORYLOG_VIEW", cons);
command.CommandType = CommandType.StoredProcedure;
}
if (myDataSet == null)
myDataSet = new DataSet();
GetActualData();
}
catch (Exception p)
{
MessageBox.Show(""+p);
}
MessageBox.Show("Being called");
}
private void GetActualData()
{
myDataSet.Clear();
command.Notification = null;
SqlDependency dependecy = new SqlDependency(command);
dependecy.OnChange +=new OnChangeEventHandler(dependecy_OnChange);
using (SqlDataAdapter adapter = new SqlDataAdapter(command))
{
adapter.Fill(myDataSet, "dbo.ACCOUNT, dbo.INVENTORYLOG, dbo.INVENTORYLOGDETAILS, dbo.INVENTORY, dbo.PRODUCT_DTL,dbo.COLOR,dbo.BRAND,dbo.CATEGORY,dbo.PRODUCTDESCRIPTION, dbo.SIZES");
gridControl1.DataSource = myDataSet.Tables["dbo.ACCOUNT, dbo.INVENTORYLOG, dbo.INVENTORYLOGDETAILS, dbo.INVENTORY, dbo.PRODUCT_DTL,dbo.COLOR,dbo.BRAND,dbo.CATEGORY,dbo.PRODUCTDESCRIPTION, dbo.SIZES"];
gridView1.BestFitColumns();
gridView1.BestFitMaxRowCount = 10;
}
}
delegate void UIDelegate();
public void dependecy_OnChange(object sender, SqlNotificationEventArgs e)
{
try
{
UIDelegate uidel = new UIDelegate(RefreshDatas);
this.Invoke(uidel, null);
SqlDependency dependency = (SqlDependency)sender;
dependency.OnChange -= dependecy_OnChange;
}
catch (Exception es)
{
// XtraMessageBox.Show(es.Message);
}
}
public void RefreshDatas()
{
////////////////////////
//--------------------------------------- NOTIFICATION INSERTS HERE ----------------------------------- //////
label1.Text = "Changes Happened";
GetActualData();
}
/// <summary>
/// //////////////////////////////////////////////////////////////////////////////////////////////////
/// //-------------------------------------------------------- SQL NOTIFICATION ------------------------------------
/// </summary>
/// <param name="args"></param>
public SqlConnection ConnectionStringMethod()
{
SqlConnection con = new SqlConnection(connection);
con.Open();
return con;
}
private void Inventory_InventoryLog_Load(object sender, EventArgs e)
{
GetActivateData();
}
これらの問題に対する答えが本当に必要です。助けてください...ありがとう:)