有两个表格cnmd
和cnmd2
具有相同的结构。我想复制cnmd
中cnmd2
的所有数据,按md_cnchar
中的字符数排序SELECT `md_id`, `md_lesson`, `md_topics`, `md_level`, `md_cnchar`,
`md_pytone`, `md_pytone_ws`, `md_pytone_n`, `md_pytone_n_ws`, `md_pinyin`,
`md_pinyin_ws`, `md_engword`, `md_sound`, `md_hints` FROM `cnmd`
WHERE 1 ORDER BY CHAR_LENGTH(md_cnchar);
}。
md_cnchar
这项工作适合按INSERT INTO `cnmd2`(`md_id`, `md_lesson`, `md_topics`, `md_level`,
`md_cnchar`, `md_pytone`, `md_pytone_ws`, `md_pytone_n`,
`md_pytone_n_ws`, `md_pinyin`, `md_pinyin_ws`, `md_engword`, `md_sound`,
`md_hints`) SELECT `md_id`, `md_lesson`, `md_topics`, `md_level`,
`md_cnchar`, `md_pytone`, `md_pytone_ws`, `md_pytone_n`,
`md_pytone_n_ws`, `md_pinyin`, `md_pinyin_ws`, `md_engword`, `md_sound`,
`md_hints` FROM `cnmd` WHERE 1 ORDER BY CHAR_LENGTH(md_cnchar);
中的字符数排序。
但是..
md_cnchar
这不适用于按md_id
中的字符数排序。
已解决问题:在查询中移除自动增量键INSERT INTO `cnmd2`( `md_lesson`, `md_topics`, `md_level`, `md_cnchar`,
`md_pytone`, `md_pytone_ws`, `md_pytone_n`, `md_pytone_n_ws`,
`md_pinyin`, `md_pinyin_ws`, `md_engword`, `md_sound`, `md_hints`)
SELECT `md_lesson`, `md_topics`, `md_level`, `md_cnchar`, `md_pytone`,
`md_pytone_ws`, `md_pytone_n`, `md_pytone_n_ws`, `md_pinyin`,
`md_pinyin_ws`, `md_engword`, `md_sound`, `md_hints` FROM `cnmd` ORDER BY CHAR_LENGTH(md_cnchar);
。
string path = Environment.CurrentDirectory + "/" + "latlong.txt";
private void button1_Click(object sender, EventArgs e)
{
if (!File.Exists(path))
{
File.CreateText(path);
MessageBox.Show("File has been created.");
}
}
private void button2_Click(object sender, EventArgs e)
{
using (StreamWriter stwr = new StreamWriter(path))
{
for (int i = 0; i < listBox1.Items.Count; i++)
{
stwr.WriteLine("googleMap.addMarker(new MarkerOptions().position(new LatLng(" + listBox1.Items[i] + ", " + "ii" + ")).title(" + "bbb" + "));");
}
stwr.Close();
string text = File.ReadAllText("latlong.txt");
for (int ii = 0; ii < listBox2.Items.Count; ii++)
{
text = text.Replace("ii", Convert.ToString(listBox2.Items[ii]));
}
File.WriteAllText("latlong.txt", text);
}
}