这是我使用的语句:
string mystring = "Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = 'D:/test1.xls';Extended Properties=Excel 8.0";
        OleDbConnection cnnxls = new OleDbConnection(mystring);
        OleDbDataAdapter myDa = new OleDbDataAdapter("select * from [Sheet1$]", cnnxls);
        DataSet myDs = new DataSet();
        myDa.Fill(myDs);
        if (myDs.Tables[0].Rows.Count > 0)
        {
            string strSql = "";
            string CnnStr = "server=server;uid=IUSR_ZHAO;pwd=33800722;Database=TNet";
            SqlConnection conn = new SqlConnection(CnnStr);
            conn.Open();
            SqlCommand myCmd = null;
            for (int i = 0; i < myDs.Tables[0].Rows.Count; i++)
            {
                strSql = "Insert Into T_Expert(Name,sex,E-Mail,Address,Telephone,JobTitle,age,Company,Specialty)values ('";
                strSql+=myDs.Tables[0].Rows[i].ItemArray[0].ToString()+"','";
                strSql += myDs.Tables[0].Rows[i].ItemArray[1].ToString() + "','";
                strSql += myDs.Tables[0].Rows[i].ItemArray[2].ToString() + "','";
                strSql += myDs.Tables[0].Rows[i].ItemArray[3].ToString() + "')";
                strSql += myDs.Tables[0].Rows[i].ItemArray[4].ToString() + "','";
                strSql += myDs.Tables[0].Rows[i].ItemArray[5].ToString() + "','";
                strSql += myDs.Tables[0].Rows[i].ItemArray[6].ToString() + "')";
                strSql += myDs.Tables[0].Rows[i].ItemArray[7].ToString() + "','";
                strSql += myDs.Tables[0].Rows[i].ItemArray[8].ToString() + "')";                try
                {
                    myCmd = new SqlCommand(strSql,conn);
                    myCmd.ExecuteNonQuery();
                    Response.Write("<script>alert('Succeed')</script>");
                }
                catch
                {
                    Label1.Text="<script>alert('Failed');</script>";
                }
            }
                conn.Close();
                conn.Dispose();        }
但是每次都是返回“Failed!”上面的语句有错误吗?