C# SQL感叹错误

C# SQL感叹错误,c#,sqlite,C#,Sqlite,我试过的 我试过使用数据适配器,但它不起作用。我试过使用数据读取器,但我不知道如何正确地使用它 我想获取当前要保存并显示在数据网格视图中的值12.0。如果我按12.1键,它也只能像12.0一样工作。它将在数据网格视图中输入并显示为12 private void button1_Click(object sender, EventArgs e) { if (comboBoxstaff.Text == string.Empty) { MessageBox.Show("

我试过的 我试过使用数据适配器,但它不起作用。我试过使用数据读取器,但我不知道如何正确地使用它

我想获取当前要保存并显示在数据网格视图中的值12.0。如果我按12.1键,它也只能像12.0一样工作。它将在数据网格视图中输入并显示为12

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

    }
    else if (textBox1.Text == string.Empty)
    {
        MessageBox.Show("Please Key in W.S thickness");// not to let thetextbox empty
        return;

    }
    else if (textBox2.Text == string.Empty)
    {
        MessageBox.Show("Please Key in G.S thickness");// not to let thecombobox empty

    }
    SQLiteConnection insertsess = new SQLiteConnection("Data Source=|DataDirectory|\\test1db");
    string insert12 = "INSERT INTO thickness (GaugeMan,Dateandtime, CompondRubber,GSthickness,WSthicknes) VALUES ('" + comboBoxstaff.Text + "','" + label2.Text + "', '" + comboBoxcompondrubber.Text + "', '" + textBox2.Text + "', '" + textBox1.Text + "')";   //insert statment
    SQLiteCommand ins1 = new SQLiteCommand(insert12, insertsess);
    insertsess.Open();
    ins1.ExecuteNonQuery();
    MessageBox.Show("Data had been saved");// showed when the message is being saved

    SQLiteConnection sesscheck = new SQLiteConnection("Data Source=|DataDirectory|\\test1db");
    SQLiteCommand chk1;
    chk1 = sesscheck.CreateCommand();
    chk1.CommandText = "SELECT GaugeMan,Dateandtime, CompondRubber,GSthickness,WSthicknes FROM thickness WHERE CompondRubber = '" + comboBoxcompondrubber.Text.Trim() + "'";
   sesscheck.Open();
    DataTable thicknessTable = new DataTable();
    //DataTable thicknessTable = new DataTable();
    SQLiteDataReader reader = chk1.ExecuteReader();
    thicknessTable.Load(reader);
    //SQLiteDataReader reader1 = chk2.ExecuteReader();
    //thicknessTable.Load(reader1);
    sesscheck.Close();

    dt = new DataTable();
    sda.Fill(dt);
    dataGridView1.DataSource = dt;

}

我认为这是一个演示问题。您应该使用Java中的一些东西,比如十进制格式化程序来使用一个小数点。然后,
12
将显示为
12.0
。有什么例子让我看吗?但在我的SQLite上,它确实显示了12.0Hmm…我的观点一点也不明白。完全忽略在SQLite上看到的任何内容,因为它也在显示演示文稿。只需检查返回到C#代码的值,并按您希望的方式格式化即可。