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

ما هي المشكلة في هذا الكود

بدأه zadi في 31 يناير 2009 · 0 رد · 438 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1

شباب ممكن اي خبير في ASP.Net يفيدني في هذا الكود وماهي مشكلتة عند التنفيذ لايحفظ كافة الحقول فقط يقوم بحفظ بعض الحقول دون البقية

ارجوا مساعدتي وفي الكود عبار عن اضافة بيانات لمريض جديد في القاعدة في SQL server 2005 ارجوا الرد يا شباب

ولو في حد عندة كود افضل لافافة البيانات للقاعدة

   Protected Sub SaveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveButton.Click
		Dim PatientConnectioString As String = ConfigurationManager.ConnectionStrings("SqlPatientConnectionString").ConnectionString
		Dim ConnectiontoPatient As New SqlConnection(PatientConnectioString)

		Dim PatientCommand As New SqlCommand("INSERT INTO Patient" & _
		"(PatientFullName ,SectionName ,DoctorName ,Age ,Nationality ,Sex ,Phone ,BloodType ,MaritalSatuts" & _
		" ,Job ,Address ,City ,RegistrationDate ,RegisterName ,Investigations) VALUES" & _
		" (@PatientFullName ,@SectionName ,@DoctorName " & _
		",@Age ,@Nationality ,@Sex ,@Phone,@BloodType ," & _
		",@MaritalSatuts ,@Job " & _
		",@Address ,@City ,@RegistrationDate ,@RegisterName ,@Investigations)", ConnectiontoPatient)

		PatientCommand.Parameters.AddWithValue("@PatientFullName", FullNameTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@SectionName", InvestigationsTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@DoctorName", SpecialistDoctorTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@Age", AgeTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@Nationality", NationalityDropDownList.Text)
		PatientCommand.Parameters.AddWithValue("@Sex", SexDropDownList.Text)
		PatientCommand.Parameters.AddWithValue("@Phone", PhoneTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@BloodType", BloodGroupDropDownList.Text)
		PatientCommand.Parameters.AddWithValue("@MaritalSatuts", MaritalStateDropDownList.Text)
		PatientCommand.Parameters.AddWithValue("@Job", JobTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@Address", AddressTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@City", CityTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@RegistrationDate", Date.Now)
		PatientCommand.Parameters.AddWithValue("@RegisterName", RegisterNameTextBox.Text)
		PatientCommand.Parameters.AddWithValue("@Investigations", InvestigationsTextBox.Text)
		Try
			ConnectiontoPatient.Open()
			PatientCommand.ExecuteNonQuery()
			ResultsLabel.Text = "Patient Add Successfully"
		Catch ex As Exception
			ResultsLabel.Text = "Error Inserting Record. "
			ResultsLabel.Text += Err.Description
		Finally
			ConnectiontoPatient.Close()
		End Try
	End Sub

تم تعديل هذه المشاركة بواسطة hazzoom في 31 يناير 2009 في 17:05 — السبب: CODE Tag added by moderator

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