123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- SqlConnection connection;
- SqlCommand command;
- SqlDataAdapter adapter;
- DataTable table;
- connection = SqlConnection("Server//....);
- connection = new SqlConnection;
- command = new SqlCommand();
- command.Connection = connection;
- command.Type = Command.Type.Text;
- adapter = new SqlAdapter(command);
- table = new DataTable();
- datagridview.Columns.Clear();
- datagridview.DataSource=null;
- command.CommandText=text;
- table.Clear();
- adapter.Fill(table);
- datagrid.DataSource=table;
- connection = new SqlConnection(::);
- command = new SqlCommand;
- command.Connection= connection;
- command.Type= Command.Tyype.Text;
- adapter = new SqlDataAdater(command);
- table= new DataTable();
- dgv.Columns.Clear();
- dgv.DataSource = null;
- command.CommandText=text;
- table.Clear();
- adapter.Fill(table);
- dgv.Datasource=table;
- connection = new SqlConnection("");
- commnd = new SqlCommand();
- coomand.Connection=connection;
- command.Type=Command.Type.Text;
- adapter= new SqlDataAdapter(command);
- table = new DataTable();
- dgv.Columns.Clear()l
- dgv.DataSource=null;
- command.CommandText=text;
- table.Clear();
- adapter.Fill(table);
- dgv.datasource=table;
- SqlConnection connection;
- SqlCommand command;
- SqlDataAdapter adapter;
- DataTable table;
- connection = new SqlConnection();
- connection = new SqlConnection;
- command = new command;
- command.Connection=connection;
- command.Type = Command.Type.Text;
- adapter = new SqlDataAdapter(coomand);
- table = new DataTable();
- dgv.COlumns.Clear();
- dgv.DataSource = null;
- command.CommandText=text;
- table.Clear();
- adapter.Fill(text);
- dgv.DataSource = table;
- SqlConnection connection;
- SqlCommand command;
- SqlDataAdapter adapter;
- DataTable table;
- connection = new SqlConnection();
- command = new SqlCommand();
- command.Connection = connection;
- command.Type = Command.Type.Text;
- adapter = new SqlDataAdapter(command);
- table = new DataTable();
- dgv.Columns.Clear();
- dgv.DataSource=null;
- command.CommandText=text;
- table.Clear();
- adapter.Fill(text);
- dgv.Datasource=table;
- if (MessageBox.Show("вы хотите удалить?", "Ошибка", MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
- {
- connection.Open();
- command.CommandText = ("Delete From Users Where id=@id");
- command.Parameters.AddWithValue("@id",dataGridView1.CurrentRow.Cells[0].Value);
- command.ExecuteReader();
- command.Parameters.Clear();
- connection.Close();
- MessageBox.Show("МНе похуй баля");
- ShowTable("Select * From Users");
- dataGridView1.Columns[0].Visible = false;
- if(MessageBox.Show("Удалить пользователя?","Внимание",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
- {
- connection.Open();
- command.CommandText=("Delete From Users Where id=@id");
- command.Parameters.AddWithValue("@id", dataGridView1.CurrentRow.Cells[0].Value);
- command.ExecuteReader();
- command.Parameters.Clear();
- connection.Close();
- }
- var db = new DataClasses1DataContext();
- var data = new Users
- {
- Login = LogBox.Text,
- Password = PassBox.Text
- };
- db.Users.InsertOnSubmit(data);
- db.SubmitChanges();
- MessageBox.Show("Пользователь успешно добавлен!");
- Form1 p = new Form1();
- p.Show();
- this.Hide();
- private void Войти_Click(object sender, EventArgs e)
- {
- var db = new BaseDataContext();
- var data = db.Users.FirstOrDefault(u =>u.Login == LoginBox.Text&&u.Password == PassBox.Text);
- if (data == null)
- {
- MessageBox.Show("ne");
- }
- else
- {
- Просмотр m = new Просмотр();
- m.Show();
- this.Hide();
- }
|