Hirdetés

Új hozzászólás Aktív témák

  • Cool Face

    aktív tag

    válasz h1ght3chzor #6963 üzenetére

    Szia.

    A 4 db radioButton közül a kijelöltet tartalmazó text-et az adatbázisba.

    RadioButton-ok:
    Level 1 - radioButton_lvl1
    Level 2 - radioButton_lvl2
    Level 3 - radioButton_lvl3
    Level 4 - radioButton_lvl4
    Level 5 - radioButton_lvl5

    Ha a fentiek közül kijelölök egyet akkor azt a text-et menti el(Level 1, Level2 etc).

    A lenti kódig jutottam el. Fölösleges dolgokat kitöröltem.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.OleDb;

    namespace Honeywell_SDE_Application
    {
    public partial class PPAP_Create : Form
    {
    private OleDbConnection connection = new OleDbConnection();
    public PPAP_Create()
    {
    InitializeComponent();
    connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\h109536\Documents\PPAPdatabase_excel.accdb;
    Persist Security Info = False; ";
    }

    private void HWapp_Load(object sender, EventArgs e)
    {
    try
    {
    connection.Open();
    check_connection.Text = "Database Connection Succesful!";
    connection.Close();
    }
    catch (Exception ex)
    {
    MessageBox.Show("Error " + ex);
    }
    }

    private void button3_Click(object sender, EventArgs e)
    {
    this.Hide();
    new PPAP_Selection().Show();
    }

    private void button_submit_Click(object sender, EventArgs e)
    {
    try
    {
    connection.Open();
    OleDbCommand command = new OleDbCommand();
    command.Connection = connection;
    command.CommandText = "Insert into PPAPdatabase ([PSW ID],[Part Name],[Part Number],[Part rev Level],[Drawing Number],[Drawing rev Level],[Comment (or Enovia No#)],[Supplier Name],[Date Created],[Owner],[Production Line],[Status],[Reason]) values('"+
    txt_PSW_ID.Text +"','"+ txt_partname.Text +"','"+ txt_partnumber.Text +"', '"+ txt_partrevlvl.Text +"', '"+ txt_dwgnumber.Text +"', '"+ txt_dwgrev.Text +"', '"+ txt_comment.Text +"', '"+
    txt_suppliername.Text +"','"+ dateTimePicker_datecreated.Text +"','"+ checkedListBox_owner.Text +"','"+ checkedListBox_prodline.Text +"', '"+ txt_status.Text + "', '"+ comboBox_PPAP.Text + "')";

    command.ExecuteNonQuery();
    MessageBox.Show("PPAP has been submitted");
    connection.Close();
    }
    catch (Exception ex)
    {
    MessageBox.Show("Error " + ex);
    }
    }
    private void radioButton_lvl1_CheckedChanged(object sender, EventArgs e)
    {

    }

    private void radioButton_lvl2_CheckedChanged(object sender, EventArgs e)
    {

    }

    private void radioButton_lvl3_CheckedChanged(object sender, EventArgs e)
    {

    }

    private void radioButton_lvl4_CheckedChanged(object sender, EventArgs e)
    {

    }

    private void radioButton_lvl5_CheckedChanged(object sender, EventArgs e)
    {

    }
    }
    }

    [ Szerkesztve ]

Új hozzászólás Aktív témák