我这里错在哪了?来帮我看看!!!
是将Excel导入到数据库的
private void Button1_Click(object sender, System.EventArgs e)
{
SqlConnection con=new SqlConnection( "server=.;database=ExcelToSql;uid=sa;pwd=; ");
con.Open();
SqlCommand cmd=new SqlCommand( "insert into test select * from OPENROWSET( 'MICROSOFT.JET.OLEDB.4.0 ', 'Excel 5.0;HDR=YES;DATABASE=c:\test.xls ',sheet1$) ",con);
cmd.ExecuteReader();
}
应该怎么改才对??????谢谢!!!
------解决方案--------------------cmd.ExecuteNonQuery();