StreamReader sr = new StreamReader("E:\\");//File path
string oneLine;
while ((oneLine = ()) != null)
{
string[] str = ('|');
string sql = "insert into TableDX(number,name,produce,xinghao) values('" + str[0].ToString() + "','" + str[1].ToString().Replace("'","'") + "','" + str[2].ToString() + "','" + str[3].ToString() + "')";
string strConn = "Data Source=.;Initial Catalog=master;User ID=sa;Password=sa";//Connection string
SqlConnection conn = new SqlConnection(strConn);
int res = 0;
();
SqlCommand cmd = new SqlCommand(sql, conn);
res = ();
();
}
();
("<script>alert('Import Successfully');</script>");