日期:2014-05-17  浏览次数:20799 次

sql ce 里面写入数据问题
                        using (SqlCeConnection conn1 = new SqlCeConnection(SqlCeHelper.ConnectionString))
                        {
                            SqlCeCommand cmd1 = new SqlCeCommand();
                            cmd1.Connection = conn1;
                            conn1.Open();
                            for (int i = 0; (i <dt.Rows.Count ; i++)
                            {
                                sqlText = "insert iteminfo (pluno,barcode,pluname,slprc ) values  ('" + dt.Rows[i][0].ToString() + "','" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "')";
                                cmd1.CommandText = sqlText;//循环 
                                cmd1.ExecuteNonQuery();
                            }

                            conn1.Close();
                            cmd1.Dispose();