//序号
index = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("b")[0].InnerHtml;
//题目
title = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[0].InnerHtml.Split('.')[1];
ntr++;
//A项
A = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
//图片
try
{
imageURL = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("img")[0].GetAttribute("src");
imageURL = imageURL.Substring(imageURL.LastIndexOf('/') + 1);
textBox1.Text = imageURL;
}
catch
{
imageURL = "";
}
ntr++;
//B项
B = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
ntr++;
//C项
C = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
ntr++;
//D项
D = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
ntr++;
//答案
key = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].GetElementsByTagName("font")[0].InnerHtml[6].ToString();
ntr++;
string temp = " INSERT INTO Exam"+
" ([index], title, A, B, C, D, type, [key], imageURL)"+
" VALUES ({0}, '{1}', '{2}', '{3}', '{4}', '{5}', 'only4', '{6}', '{7}')";
string[] args = new string[8] { index, title, A, B, C, D, key, imageURL };
sb.AppendLine(string.Format(temp, args) + "@");
index = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("b")[0].InnerHtml;
//题目
title = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[0].InnerHtml.Split('.')[1];
ntr++;
//A项
A = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
//图片
try
{
imageURL = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("img")[0].GetAttribute("src");
imageURL = imageURL.Substring(imageURL.LastIndexOf('/') + 1);
textBox1.Text = imageURL;
}
catch
{
imageURL = "";
}
ntr++;
//B项
B = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
ntr++;
//C项
C = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
ntr++;
//D项
D = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].InnerHtml;
ntr++;
//答案
key = webBrowser1.Document.Body.GetElementsByTagName("tr")[ntr].GetElementsByTagName("td")[1].GetElementsByTagName("font")[0].InnerHtml[6].ToString();
ntr++;
string temp = " INSERT INTO Exam"+
" ([index], title, A, B, C, D, type, [key], imageURL)"+
" VALUES ({0}, '{1}', '{2}', '{3}', '{4}', '{5}', 'only4', '{6}', '{7}')";
string[] args = new string[8] { index, title, A, B, C, D, key, imageURL };
sb.AppendLine(string.Format(temp, args) + "@");