保存下的代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            string insql = "INSERT INTO t_pzfl (time, pzh, zy, km, jfje, dfje, hjjf, hjdf, zd, sh, gz) VALUES (" + this.textBox1.Text + ",'" + this.textBox2.Text + "', " + this.textBox3.Text + "'" + this.textBox4.Text + "'" + this.textBox5.Text + "'" + this.textBox6.Text + "'" + this.textBox23.Text + "'" + this.textBox24.Text + "'" + this.textBox25.Text + "'" + this.textBox26.Text + "'" + this.textBox27.Text + "')";
          
            
            SqlConnection con = new SqlConnection("server=.;database=caiwu;user id=sa;password=81719413");
            
           con.Open();
          
            SqlCommand com = new SqlCommand(insql, con );
            SqlDataReader reader = com.ExecuteReader();            MessageBox.Show("保存成功!");
           
        }
    }
}

解决方案 »

  1.   

     SqlDataReader reader = com.ExecuteReader(); 
    >>>改为
    int num=com.ExecuteNonQuery();
      

  2.   

    因为有数据改动“SqlDataReader reader = com.ExecuteReader(); ”是没用的,它是只读的
      

  3.   

    con.Open();
    SqlCommand com = new SqlCommand("", con);
    com.ExecuteNonQuery();//执行sql
    con.Close();
      

  4.   

    另外,如果是用ACCESS数据库,不要用‘time’字段,我的教训
      

  5.   

    insql语句错了
    INSERT INTO t_pzfl (time, pzh) VALUES ('"+textBox1.Text +"','"+textBox2.Text +"');
      

  6.   

    还不行啊,谁再思考下,怎么搞才能不出现 未处理SqlEexeption!