private void scriviexcel(string filexcel)//fileexcel="c:\\prova.xls"; { string scheda="table1"; OleDbConnection conn = new OleDbConnection(); OleDbCommand command = new OleDbCommand(); conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filexcel + ";Extended Properties=Excel 8.0;");//HDR=YES;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0"""; string datao = DateTime.Now.ToString(); datao=datao.Substring(0, 10); //cut the time from DateTime so datao="02/11/2011"; string pro = "INSERT INTO " + scheda + "(nome,indirizzo,telefono,difetto,data) VALUES('{" + textBox1.Text + "}','{" + textBox2.Text + "}','{" + textBox3.Text + "}','{" + textBox4.Text + "}','{"+datao+"}')"; command = new OleDbCommand ( pro,conn ); command.Connection.Open(); command.ExecuteNonQuery(); command.Connection.Close(); conn.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)