private void button2_Click(object sender, EventArgs e) { int id = Int32.Parse(textBox11.Text); DataClasses1DataContext dbcon = new DataClasses1DataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + @"C:\Users\user\documents\visual studio 2013\Projects\DemoProjectApplication2\DemoProjectApplication2\Database1.mdf" + @";Integrated Security=True"); Games_table gt = dbcon.Games_tables.SingleOrDefault(x => x.Id == id); if (gt != null) { gt.name = textBox1.Text; gt.os = textBox2.Text; gt.processor = textBox3.Text; gt.ram = textBox4.Text; gt.gpu = textBox5.Text; gt.directx = textBox6.Text; gt.hdd = textBox7.Text; gt.release = textBox8.Text; gt.genre_type = textBox9.Text; gt.genre_id = Int32.Parse(textBox10.Text); gt.image = image; dbcon.SubmitChanges(); MessageBox.Show("Data Updated"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox10.Text = ""; pictureBox1.Image = null; } }
private void button3_Click(object sender, EventArgs e) { string name = textBox1.Text; string os = textBox2.Text; string processor = textBox3.Text; string ram = textBox4.Text; string gpu = textBox5.Text; string directx = textBox6.Text; string hdd = textBox7.Text; string release = textBox8.Text; string genre = textBox9.Text; int genre_id = Int32.Parse(textBox10.Text); Games_table gt = new Games_table(); gt.name = name; gt.os = os; gt.processor = processor; gt.ram = ram; gt.gpu = gpu; gt.directx = directx; gt.hdd = hdd; gt.release = release; gt.genre_type = genre; gt.genre_id = genre_id; gt.image = image; DataClasses1DataContext dbcon = new DataClasses1DataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + @"C:\Users\user\documents\visual studio 2013\Projects\DemoProjectApplication2\DemoProjectApplication2\Database1.mdf" + @";Integrated Security=True"); dbcon.Games_tables.InsertOnSubmit(gt); dbcon.SubmitChanges(); MessageBox.Show("Data Inserted"); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string selectName = comboBox1.Text.ToString(); DataClasses1DataContext dbcon = new DataClasses1DataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + @"C:\Users\user\documents\visual studio 2013\Projects\DemoProjectApplication2\DemoProjectApplication2\Database1.mdf" + @";Integrated Security=True"); Games_table found = dbcon.Games_tables.SingleOrDefault(x => x.name == selectName); if (found != null) { textBox12.Text = found.os; textBox11.Text = found.processor; textBox10.Text = found.ram; textBox9.Text = found.gpu; textBox8.Text = found.directx; textBox7.Text = found.hdd; } }
private void button1_Click(object sender, EventArgs e) { int id = Int32.Parse(textBox1.Text); DataClasses1DataContext dbcon = new DataClasses1DataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + @"C:\Users\user\documents\visual studio 2013\Projects\DemoProjectApplication2\DemoProjectApplication2\Database1.mdf" + @";Integrated Security=True"); Games_table gt = dbcon.Games_tables.SingleOrDefault(x => x.Id == id); if (gt != null) { dbcon.Games_tables.DeleteOnSubmit(gt); dbcon.SubmitChanges(); MessageBox.Show("Data Deleted"); } else { MessageBox.Show("Data Not Found"); } }
private void button1_Click(object sender, EventArgs e) { string selectName = comboBox1.Text.ToString(); DataClasses1DataContext dbcon = new DataClasses1DataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + @"C:\Users\user\documents\visual studio 2013\Projects\DemoProjectApplication2\DemoProjectApplication2\Database1.mdf" + @";Integrated Security=True"); Games_table found = dbcon.Games_tables.SingleOrDefault(x => x.name == selectName); if (found != null) { textBox1.Text = found.os; textBox2.Text = found.processor; textBox3.Text = found.ram; textBox4.Text = found.gpu; textBox5.Text = found.directx; textBox6.Text = found.hdd; textBox10.Text = found.release; textBox8.Text = found.genre_type; textBox9.Text = found.genre_id.ToString(); pictureBox1.Image = Image.FromFile(found.image); } else { MessageBox.Show("Not Found"); } }
partial void DeleteGames_table(Games_table instance);
partial void UpdateGames_table(Games_table instance);
partial void InsertGames_table(Games_table instance);
private void detach_Games_tables(Games_table entity) { this.SendPropertyChanging(); entity.Category1 = null; }