ΠŸΠΎΠΌΠΎΡ‰ΡŒ Π² ΡƒΡ‡Ρ‘Π±Π΅, ΠΎΡ‡Π΅Π½ΡŒ быстро...
Π Π°Π±ΠΎΡ‚Π°Π΅ΠΌ вмСстС Π΄ΠΎ ΠΏΠΎΠ±Π΅Π΄Ρ‹

ОписаниС ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹. 
Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ прилоТСния "Гостиница" Π² срСдС программирования Π‘#

Π Π΅Ρ„Π΅Ρ€Π°Ρ‚ΠŸΠΎΠΌΠΎΡ‰ΡŒ Π² Π½Π°ΠΏΠΈΡΠ°Π½ΠΈΠΈΠ£Π·Π½Π°Ρ‚ΡŒ ΡΡ‚ΠΎΠΈΠΌΠΎΡΡ‚ΡŒΠΌΠΎΠ΅ΠΉ Ρ€Π°Π±ΠΎΡ‚Ρ‹

TextBox9.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π½ΠΎΠΌΠ΅Ρ€_пасп»); TextBox6.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π½ΠΎΠΌΠ΅Ρ€_Ρ‚Π΅Π»»); TextBox5.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π½ΠΎΠΌΠ΅Ρ€_ΠΊΠΎΠΌ»); TextBox3.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.отчСство»); TextBox2.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.фамилия»); Cmd.Parameters.Add (new SqlParameter («@Π½ΠΎΠΌΠ΅Ρ€Ρ‚Π΅Π»», SqlDbType. VarChar… Π§ΠΈΡ‚Π°Ρ‚ΡŒ Π΅Ρ‰Ρ‘ >

ОписаниС ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹. Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ прилоТСния "Гостиница" Π² срСдС программирования Π‘# (Ρ€Π΅Ρ„Π΅Ρ€Π°Ρ‚, курсовая, Π΄ΠΈΠΏΠ»ΠΎΠΌ, ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»ΡŒΠ½Π°Ρ)

Π’ Π΄Π°Π½Π½ΠΎΠΌ Ρ€Π°Π·Π΄Π΅Π»Π΅ ΠΎΠΏΠΈΡΡ‹Π²Π°ΡŽΡ‚ΡΡ:

  • — Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΈ ΠΊΠ»ΠΈΠ΅Π½Ρ‚ΠΎΠ² Π² Π±Π°Π·Π΅ Π΄Π°Π½Π½Ρ‹Ρ…;
  • — ΠΏΠ΅Ρ‡Π°Ρ‚ΡŒ ΠΈ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΈ Π² Π±Π°Π·Π΅ Π΄Π°Π½Π½Ρ‹Ρ…

using System;

using System.Collections.Generic;

using System. ComponentModel;

using System. Data;

using System. Drawing;

using System. Linq;

using System. Text;

using System.Windows.Forms;

using System.Data.SqlClient;

using System.Data.SqlTypes;

namespace Гостиница.

public partial class Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅: Form.

Form pourtr = null;

public Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ (Form tre).

InitializeComponent ();

pourtr = tre;

private void button1_Click (object sender, EventArgs e).

SqlConnection cn = new SqlConnection (@" data source =КРИБ-ПКSQLEXPRESS;initial catalog = Гостиниц;integrated security = true");

try.

SqlCommand cmd = new SqlCommand («insert into датагостница (имя, фамилия, отчСство, ΠΏΠΎΠ»,[Π½ΠΎΠΌΠ΅Ρ€_ΠΊΠΎΠΌ],[Π½ΠΎΠΌΠ΅Ρ€_Ρ‚Π΅Π»], Π΄Π°Ρ‚Π°1, Π΄Π°Ρ‚Π°2, [Π½ΠΎΠΌΠ΅Ρ€_пасп]) values (@ΠΈΠΌ, @Ρ„Π°ΠΌΠΈ, @ΠΎΡ‡Ρ‚Π΅, @ΠΏΠΎ, @Π½ΠΎΠΌΠ΅Ρ€ΠΊΠΎΠΌ, @Π½ΠΎΠΌΠ΅Ρ€Ρ‚Π΅Π», @Π΄Π°Ρ‚Π°1, @Π΄Π°Ρ‚Π°2, @номСрпас)», cn);

cmd.Parameters.Add (new SqlParameter («@ΠΈΠΌ», SqlDbType. VarChar, 50));

cmd.Parameters.Add (new SqlParameter («@Ρ„Π°ΠΌΠΈ», SqlDbType. VarChar, 50));

cmd.Parameters.Add (new SqlParameter («@ΠΎΡ‡Ρ‚Π΅», SqlDbType. VarChar, 50));

cmd.Parameters.Add (new SqlParameter («@ΠΏΠΎ», SqlDbType. VarChar, 50));

cmd.Parameters.Add (new SqlParameter («@Π½ΠΎΠΌΠ΅Ρ€ΠΊΠΎΠΌ», SqlDbType.Int));

cmd.Parameters.Add (new SqlParameter («@Π½ΠΎΠΌΠ΅Ρ€Ρ‚Π΅Π»», SqlDbType. VarChar, 50));

cmd.Parameters.Add (new SqlParameter («@Π΄Π°Ρ‚Π°1», SqlDbType. Date));

cmd.Parameters.Add (new SqlParameter («@Π΄Π°Ρ‚Π°2», SqlDbType. Date));

cmd.Parameters.Add (new SqlParameter («@номСрпас», SqlDbType. VarChar, 50));

cmd.Parameters[" @ΠΈΠΌ" ]. Value = textBox1. Text;

cmd.Parameters[" @Ρ„Π°ΠΌΠΈ" ]. Value = textBox2. Text;

cmd.Parameters[" @ΠΎΡ‡Ρ‚Π΅" ]. Value = textBox3. Text;

cmd.Parameters[" @ΠΏΠΎ" ]. Value = textBox4. Text;

cmd.Parameters[" @Π½ΠΎΠΌΠ΅Ρ€ΠΊΠΎΠΌ" ]. Value = textBox5. Text;

cmd.Parameters[" @Π½ΠΎΠΌΠ΅Ρ€Ρ‚Π΅Π»" ]. Value = textBox6. Text;

cmd.Parameters[" @Π΄Π°Ρ‚Π°1″ ]. Value = textBox7. Text;

cmd.Parameters[" @Π΄Π°Ρ‚Π°2″ ]. Value = textBox8. Text;

cmd.Parameters[" @номСрпас" ]. Value = textBox9. Text;

cn.Open ();

cmd.ExecuteNonQuery ();

MessageBox.Show (this," Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΠ»" ," «, MessageBoxButtons. OK, MessageBoxIcon. Information);

if (textBox1.Text ≠ «»).

textBox2.Text = «» ;

else.

MessageBox.Show («ΠžΡ‰ΠΈΠ±ΠΊΠ°»);

catch.

MessageBox.Show («ΠžΡ‰ΠΈΠ±ΠΊΠ°»);

finally.

textBox1.ResetText ();

textBox3.ResetText ();

textBox2.ResetText ();

textBox4.ResetText ();

textBox5.ResetText ();

textBox6.ResetText ();

textBox7.ResetText ();

textBox8.ResetText ();

textBox9.ResetText ();

cn.Close ();

private void button2_Click (object sender, EventArgs e).

this.Close ();

private void Form4_FormClosed (object sender, FormClosedEventArgs e).

pourtr.Show ();

Листинг Form5.cs.

using System;

using System.Collections.Generic;

using System. ComponentModel;

using System. Data;

using System. Drawing;

using System. Linq;

using System. Text;

using System.Windows.Forms;

using System.Data.SqlClient;

using System.Data.SqlTypes;

using System. Collections;

namespace WindowsFormsApplication19.

public partial class Form5: Form.

{ Form part = null;

public Form5(Form bs).

InitializeComponent ();

sqlcon ();

part =bs;

SqlConnection cn = new SqlConnection (@" data source =КРИБ-ПКSQLEXPRESS;initial catalog = Гостиниц;integrated security = true");

SqlCommand cmd = new SqlCommand ();

DataSet ds = new DataSet ();

SqlDataAdapter da = new SqlDataAdapter ();

SqlDataAdapter dataAdapter;

SqlCommandBuilder cb;

private void contol ().

dataGridView1.DataSource = ds;

dataGridView1.DataMember = «Π΄Π°Ρ‚агостница» ;

textBox1.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.имя»);

textBox2.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.фамилия»);

textBox3.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.отчСство»);

textBox4.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.ΠΏΠΎΠ»»);

textBox5.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π½ΠΎΠΌΠ΅Ρ€_ΠΊΠΎΠΌ»);

textBox6.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π½ΠΎΠΌΠ΅Ρ€_Ρ‚Π΅Π»»);

textBox7.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π΄Π°Ρ‚Π°1»);

textBox8.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π΄Π°Ρ‚Π°2»);

textBox9.DataBindings.Add («Text», ds, «Π΄Π°Ρ‚агостница.Π½ΠΎΠΌΠ΅Ρ€_пасп»);

private void sqlcon ().

SqlConnection cn = new SqlConnection (@" data source =КРИБ-ПКSQLEXPRESS;initial catalog = Гостиниц;integrated security = true");

string aff = «select * from датагостница» ;

SqlCommand cmd = new SqlCommand (aff, cn);

DataTable datatablt = new DataTable ();

cn.Open ();

dataAdapter = new SqlDataAdapter (cmd);

SqlCommandBuilder commandbuild = new SqlCommandBuilder (dataAdapter);

dataAdapter.Fill (datatablt);

dataGridView1.DataSource = datatablt;

cn.Close ();

private void button1_Click (object sender, EventArgs e).

if (MessageBox.Show («voulez-vous vraiment modifier la base des donnees?», «», MessageBoxButtons. YesNo) == DialogResult. Yes).

this.BindingContext[ds, «Π΄Π°Ρ‚агостница» ]. EndCurrentEdit ();

if (ds.HasChanges () ≠ true).

try.

da.Update (ds, «Π΄Π°Ρ‚агостница»);

catch.

MessageBox.Show (this, «erreur fatal», «», MessageBoxButtons. OK, MessageBoxIcon. Error);

private void Form5_Load (object sender, EventArgs e).

cn.Open ();

cmd = new SqlCommand («select * from датагостница», cn);

da = new SqlDataAdapter (cmd);

da.Fill (ds, «Π΄Π°Ρ‚агостница»);

contol ();

cb = new SqlCommandBuilder (da);

this.Close ();

private void Form5_FormClosed (object sender, FormClosedEventArgs e).

part.Show ();

ΠŸΠΎΠΊΠ°Π·Π°Ρ‚ΡŒ вСсь тСкст
Π—Π°ΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒ Ρ„ΠΎΡ€ΠΌΡƒ Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΉ Ρ€Π°Π±ΠΎΡ‚ΠΎΠΉ