public bool Insert(object bean,string tableName)
{
SqlConnection con = null;
try
{
con = new SqlConnection("server=.\\sqlexpress;database=wj;uid=sa;pwd=821123");
con.Open();
foreach (System.Reflection.PropertyInfo p in pt)
{
sql += "@"+p.Name + ",";
}
sql = sql.Substring(0, sql.Length - 1) + ")";
SqlCommand com = new SqlCommand(sql, con);
foreach (System.Reflection.PropertyInfo p in pt)
{
SqlParameter sp = new SqlParameter("@" + p.Name,p.PropertyType);
sp.Value = p.GetValue(bean, null);
com.Parameters.Add(sp);
}