我有一个项目使用C#(Visual Studio 2008)和SQL Server 2000.我在三台计算机上安装了这个项目设置。 İt在其中两个(XP SP3)正常工作,但没有其他工作(XP终极)。当只有一个窗体打开时,İt给出错误:“具有相同密钥的项目已被添加” 如何解决此问题?C#项目错误:“一个项目有相同的密钥已被添加”
源代码:
DBClass db = new DBClass();
private void FrmGiris_Load(object sender, EventArgs e)
{
string sorgu = "select top 50 * from IsTakipDetay where Asama='Yapılacak'";
DataTable data = db.DBSelect(sorgu);
if (schedulerStorage1.Appointments.Count > 0)
schedulerStorage1.Appointments.Clear();
for (int i = 0; i < data.Rows.Count; i++)
{
DevExpress.XtraScheduler.Appointment app = new DevExpress.XtraScheduler.Appointment();
app.Start = Convert.ToDateTime(data.Rows[i]["Saat"]);
app.End = Convert.ToDateTime(data.Rows[i]["Saat"]);
app.Subject = data.Rows[i]["IsAdi"].ToString() + "-" + data.Rows[i]["DetayAdi"].ToString();
DataTable dt = db.DBSelect("select MusteriAdi,Adres from IsTakip where Id=" + Convert.ToInt32(data.Rows[i]["IsId"]));
if (dt.Rows.Count > 0)
{
app.Location = dt.Rows[0]["Adres"].ToString();
app.Description = "Müşteri Adı: " + dt.Rows[0]["MusteriAdi"].ToString() + "/Personel Adı:" + data.Rows[i]["PersonelAdi"].ToString();
}
schedulerStorage1.Appointments.Add(app);
}
}
设计师代码:
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAjanda));
DevExpress.XtraScheduler.TimeRuler timeRuler1 = new DevExpress.XtraScheduler.TimeRuler();
DevExpress.XtraScheduler.TimeRuler timeRuler2 = new DevExpress.XtraScheduler.TimeRuler();
this.schedulerStorage1 = new DevExpress.XtraScheduler.SchedulerStorage(this.components);
this.ısTakipDetayBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dSet = new Dogalgaz.dSet();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.splitContainerControl1 = new DevExpress.XtraEditors.SplitContainerControl();
this.navBarControl1 = new DevExpress.XtraNavBar.NavBarControl();
this.navBarGroup1 = new DevExpress.XtraNavBar.NavBarGroup();
this.itemGunluk = new DevExpress.XtraNavBar.NavBarItem();
this.itemHafta = new DevExpress.XtraNavBar.NavBarItem();
this.itemAylik = new DevExpress.XtraNavBar.NavBarItem();
this.itemCizelge = new DevExpress.XtraNavBar.NavBarItem();
this.navBarGroupControlContainer1 = new DevExpress.XtraNavBar.NavBarGroupControlContainer();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioIs = new System.Windows.Forms.RadioButton();
this.radioPersonel = new System.Windows.Forms.RadioButton();
this.radioTum = new System.Windows.Forms.RadioButton();
this.comboKriter = new DevExpress.XtraEditors.ComboBoxEdit();
this.labelKriter = new System.Windows.Forms.Label();
this.navBarGroupControlContainer2 = new DevExpress.XtraNavBar.NavBarGroupControlContainer();
this.dateNavigator1 = new DevExpress.XtraScheduler.DateNavigator();
this.schedulerControl1 = new DevExpress.XtraScheduler.SchedulerControl();
this.navBarGroup3 = new DevExpress.XtraNavBar.NavBarGroup();
this.navBarItem2 = new DevExpress.XtraNavBar.NavBarItem();
this.navBarItem3 = new DevExpress.XtraNavBar.NavBarItem();
this.navBarItem1 = new DevExpress.XtraNavBar.NavBarItem();
this.navBarGroup2 = new DevExpress.XtraNavBar.NavBarGroup();
this.itemYazdirPencer = new DevExpress.XtraNavBar.NavBarItem();
this.itemPrintPreview = new DevExpress.XtraNavBar.NavBarItem();
this.itemPrint = new DevExpress.XtraNavBar.NavBarItem();
this.navBarGroup4 = new DevExpress.XtraNavBar.NavBarGroup();
((System.ComponentModel.ISupportInitialize)(this.schedulerStorage1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ısTakipDetayBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).BeginInit();
this.splitContainerControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).BeginInit();
this.navBarControl1.SuspendLayout();
this.navBarGroupControlContainer1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboKriter.Properties)).BeginInit();
this.navBarGroupControlContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dateNavigator1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.schedulerControl1)).BeginInit();
this.SuspendLayout();
// Other controls codes//////////////////////
//
// FrmAjanda
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(974, 562);
this.Controls.Add(this.splitContainerControl1);
this.Name = "FrmAjanda";
this.Text = "DOĞALGAZ TAKİP - AJANDA";
this.Load += new System.EventHandler(this.FrmGiris_Load);
((System.ComponentModel.ISupportInitialize)(this.schedulerStorage1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ısTakipDetayBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).EndInit();
this.splitContainerControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).EndInit();
this.navBarControl1.ResumeLayout(false);
this.navBarGroupControlContainer1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.comboKriter.Properties)).EndInit();
this.navBarGroupControlContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dateNavigator1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.schedulerControl1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.BindingSource ısTakipDetayBindingSource;
private dSet dSet;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private DevExpress.XtraEditors.SplitContainerControl splitContainerControl1;
private DevExpress.XtraNavBar.NavBarControl navBarControl1;
private DevExpress.XtraNavBar.NavBarGroup navBarGroup1;
private DevExpress.XtraNavBar.NavBarItem itemGunluk;
private DevExpress.XtraNavBar.NavBarItem itemHafta;
private DevExpress.XtraNavBar.NavBarItem itemAylik;
private DevExpress.XtraNavBar.NavBarItem itemCizelge;
private DevExpress.XtraNavBar.NavBarGroup navBarGroup2;
private DevExpress.XtraNavBar.NavBarItem itemYazdirPencer;
private DevExpress.XtraNavBar.NavBarItem itemPrintPreview;
private DevExpress.XtraNavBar.NavBarItem itemPrint;
private DevExpress.XtraScheduler.SchedulerControl schedulerControl1;
public DevExpress.XtraScheduler.SchedulerStorage schedulerStorage1;
private DevExpress.XtraNavBar.NavBarItem navBarItem1;
private DevExpress.XtraNavBar.NavBarGroup navBarGroup3;
private DevExpress.XtraNavBar.NavBarItem navBarItem3;
private DevExpress.XtraNavBar.NavBarItem navBarItem2;
private DevExpress.XtraNavBar.NavBarGroupControlContainer navBarGroupControlContainer1;
private System.Windows.Forms.GroupBox groupBox1;
private DevExpress.XtraEditors.ComboBoxEdit comboKriter;
private System.Windows.Forms.Label labelKriter;
private System.Windows.Forms.RadioButton radioIs;
private System.Windows.Forms.RadioButton radioPersonel;
private System.Windows.Forms.RadioButton radioTum;
private DevExpress.XtraNavBar.NavBarGroupControlContainer navBarGroupControlContainer2;
private DevExpress.XtraScheduler.DateNavigator dateNavigator1;
private DevExpress.XtraNavBar.NavBarGroup navBarGroup4;
}
}
但问题是,它的工作两台电脑(XP SP3)上但没有第三(XP最终)为什么?
而只是这种形式给出错误其他形式正常工作。
难道是因为操作系统?
我们可能需要查看一些代码才能使用此 – 2010-09-30 08:20:40
我们实际上可能需要查看加载失败的表单的设计器代码。 – 2010-09-30 10:34:49
你编辑问题的好东西。但是你也需要其他的设计器代码。我知道它在那里很多,但一些用户控件想要将任何东西添加到集合中两次......这是需要找到的。 – 2010-10-01 10:56:38