Click here to Skip to main content
15,912,897 members

Comments by Member 13809133 (Top 1 by date)

Member 13809133 7-Jun-18 2:27am View    
Do you mean like this @originalGriff

private void button1_Click(object sender, EventArgs e)
{
if (comboBoxstaff.Text == string.Empty)
{
MessageBox.Show("Please Select gaugeman");
return;
}
else if (comboBoxcompondrubber.Text == string.Empty)
{
MessageBox.Show("Please Select Compond Rubber");
return;

}
else if (textBox1.Text == string.Empty)
{
MessageBox.Show("Please Key in W.S thickness");
return;

}
else if (textBox2.Text == string.Empty)
{
MessageBox.Show("Please Key in G.S thickness");

}
SQLiteConnection insertsess = new SQLiteConnection("Data Source=|DataDirectory|\\test1db");
string insert12 = "INSERT INTO thickness (GaugeMan,Dateandtime, CompondRubber,GSthickness,WSthicknes) VALUES (@GM, @DT, @CR, @GST, @WST)";
SQLiteCommand ins1 = new SQLiteCommand(insert12, insertsess);
ins1.Parameters.AddWithValue("@GaugeMan", comboBoxstaff.Text);
ins1.Parameters.AddWithValue("@Dateandtime", label2.Text);
ins1.Parameters.AddWithValue("@CompondRubber", comboBoxcompondrubber.Text);
ins1.Parameters.AddWithValue("@GSthickness", textBox2.Text);
ins1.Parameters.AddWithValue("@WSthicknes", textBox1.Text);
insertsess.Open();
ins1.ExecuteNonQuery();
insertsess.Close();
MessageBox.Show("Data had been saved");



dataGridView1.DataSource = null;
SQLiteConnection conn123 = new SQLiteConnection("Data Source=|DataDirectory|\\test1db");
conn123.Open();
sda = new SQLiteDataAdapter("SELECT GaugeMan,Dateandtime, CompondRubber,GSthickness,WSthicknes FROM thickness WHERE CompondRubber = '" + comboBoxcompondrubber.Text.Trim() + "'", conn123);
dt = new DataTable();
sda.Fill(dt);
dataGridView1.DataSource = dt;
conn123.Close();



}