MYSQL批量导入几何对象数据

MYSQL连接字符串

Allow User Variables=true。连接串里面加上这段代码,允许 SQL 中出现用户变量

关键代码

var path="c:\\a.csv";

var cmd = conn.CreateCommand();
cmd.CommandText = "LOAD DATA INFILE '"+path+ "' INTO TABLE route_line FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED BY '\"' (lineno, @linept, prjid ) SET linept=GeomFromText(@linept)";
cmd.ExecuteNonQuery();

你可能感兴趣的:(C#,c#)