الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة تظهرلي Frame Work

مغلق
بدأه captain_kimo في 15 مايو 2007 · 8 رد · 917 مشاهدة · في ADO.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

اخواني الكرام بعد محاولات مضنية نجحت ولله الحمد في عمل تصميم لمشروعي في الكليه حول الادو دوت نت عن شركة مصر للطيران من خلال الدروس والشروحات التي وجدتها في المنتدى , ولكن تصادفني هذه الرسالة دوما ولا اقدر على ادخال اي بيانات من بعدها , وهذه صور المشكلة .

storm_2034838807_755112502.jpg

storm_767668368_651110011.jpg

مع اني نزلت اخر اصدار للفريم وورك فيرجن 2

وهذا هو الكود المستخدم

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace EgyptAir
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Data.SqlClient.SqlConnection Con;
		private System.Windows.Forms.TextBox editPassword;
		private System.Windows.Forms.TextBox editUserID;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.editUserID = new System.Windows.Forms.TextBox();
			this.editPassword = new System.Windows.Forms.TextBox();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.Color.Silver;
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(178)));
			this.label1.Location = new System.Drawing.Point(160, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(264, 32);
			this.label1.TabIndex = 0;
			this.label1.Text = "Egypt Air Booking Program";
			// 
			// label2
			// 
			this.label2.BackColor = System.Drawing.Color.Silver;
			this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(178)));
			this.label2.Location = new System.Drawing.Point(56, 272);
			this.label2.Name = "label2";
			this.label2.TabIndex = 1;
			this.label2.Text = "User Name";
			this.label2.Click += new System.EventHandler(this.label2_Click);
			// 
			// label3
			// 
			this.label3.BackColor = System.Drawing.Color.Silver;
			this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(178)));
			this.label3.Location = new System.Drawing.Point(56, 328);
			this.label3.Name = "label3";
			this.label3.TabIndex = 2;
			this.label3.Text = "Password";
			// 
			// editUserID
			// 
			this.editUserID.Location = new System.Drawing.Point(192, 272);
			this.editUserID.Name = "editUserID";
			this.editUserID.Size = new System.Drawing.Size(152, 20);
			this.editUserID.TabIndex = 3;
			this.editUserID.Text = "";
			this.editUserID.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
			// 
			// editPassword
			// 
			this.editPassword.Location = new System.Drawing.Point(192, 328);
			this.editPassword.Name = "editPassword";
			this.editPassword.PasswordChar = '*';
			this.editPassword.Size = new System.Drawing.Size(152, 20);
			this.editPassword.TabIndex = 4;
			this.editPassword.Text = "";
			this.editPassword.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
			// 
			// button1
			// 
			this.button1.BackColor = System.Drawing.Color.Silver;
			this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(178)));
			this.button1.Location = new System.Drawing.Point(200, 416);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(104, 48);
			this.button1.TabIndex = 5;
			this.button1.Text = "Reseat";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.BackColor = System.Drawing.Color.Silver;
			this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(178)));
			this.button2.Location = new System.Drawing.Point(56, 416);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(104, 48);
			this.button2.TabIndex = 4;
			this.button2.Text = "Login";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button3
			// 
			this.button3.BackColor = System.Drawing.Color.Silver;
			this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(178)));
			this.button3.Location = new System.Drawing.Point(352, 416);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(104, 48);
			this.button3.TabIndex = 5;
			this.button3.Text = "Exit";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(692, 502);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.editPassword);
			this.Controls.Add(this.editUserID);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button3);
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			Con.Open();
		}

		private void textBox1_TextChanged(object sender, System.EventArgs e)
		{

		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			SqlCommand cmd=Con.CreateCommand();
			string Sql="SELECT *,tblogin.* FROM tblogin WHERE (UserID = '"+ editUserID +"') AND (Password ='" + editPassword.Text +"')";
			cmd.CommandText=Sql;
			SqlDataReader rdr=cmd.ExecuteReader();

			if(rdr.Read())
			{
				MessageBox.Show(" Access Accept ");
				this.Hide();
				Form2 form2 = new Form2();
				form2.Show();
			}
			else
			{
				MessageBox.Show("Access Deniy");
			}

			rdr.Close();

		}

		private void textBox2_TextChanged(object sender, System.EventArgs e)
		{

		}

		private void button3_Click(object sender, System.EventArgs e)
		{

		}

		private void button1_Click(object sender, System.EventArgs e)
		{

		}

		private void label2_Click(object sender, System.EventArgs e)
		{

		}
	}
}

شاكر جدا للجميع

ملحوظه للجميع :- بالفعل البحث في المنتدى يعطيك دفعه قوية جدا لابراز مواهبك , واحسن بمليون مره من ان يقوم حد بحل مسأله او مشروع لك .

تحياتي

#2

السلام عليكم

اخي رسالة الخطأ واضحة ان هنالك عنصر تم إنشائه دون عملية استنساخ منه ربما يكون الـ cmd أو rdr

كون لا أفهم نصوص لغة C# لكن ربما تلقي نظرة على هذا الرابط لتعرف كيف تتجاوز هذا النوع من رسائل الخطء

السلام عليكم.

في المثال يتضح المقال

#3

تسلم اخي الكريم على الرابط , لكن انا للاسف لا افهم في الفيجوال بيسك .

في انتظار شخص اخر للمساعده لاني واثق ان الكود ليس به اي اخطاء .

تحياتي

#4

لن يستطيع احد المساعدة الا اذا وضحت الخطأ أو ارسلت الصورة واضحة ..

#5
Scoool كتب:
لن يستطيع احد المساعدة الا اذا وضحت الخطأ أو ارسلت الصورة واضحة ..

اخي الكريم اضغط على الصورة التي ارفقتها في الموضوع ستكون مكبره اكثر من الازم , وهي واضحه جدا , وقد ارسلت الكود بالكامل , فلا اعلم ماذا افعل بعد ذلك لتكون الصورة اوضح من ذلك , شاكر جدا لك مساعدتي .

تحياتي

#6

No Solution ???

تحياتي

#7

عند ظهور الرسالة تتبع محرر الكود وحدد السطر الذي يسبب المشكلة حتى نستطيع مساعدتك

أعتقد أن مشكلتك في السطر

SqlCommand cmd=Con.CreateCommand();

فقط أضف السطر التالي مباشرة قبله

Con = new SqlConnection();

تم تعديل هذه المشاركة بواسطة محمد سامر أبو سلو في 20 مايو 2007 في 23:14

عن عائشة رضي الله عنها أن النبي صلى الله عليه وسلم قال: إن الله يحب إذا عمل أحدكم عملا أن يتقنه

نعيب زماننا والعيب فينا ... وما لزماننا عيب سوانا

ونهجو ذا الزمان بغير ذنب ... ولو نطق الزمان لنا هجانا

محمد سامر أبو سلو

#9

شاكر لكم اخواني على المساعده , والمشكله طلعت في نسخة الدوت نت لانها منسوخه فتعلمون كثر مشاكلها :)

تحياتي

هذا الموضوع مغلق.

مواضيع مشابهة