HzBLib.IDAL.ISBiz sBiz = HzBLib.DAL.Factory.CreateSBiz();
HzBLib.Model.Collection<HzBLib.Model.SBiz> sList = sBiz.Select("select * from s_biz");
string strconn = "server=192.168.8.101;uid=sa;pwd=sa;database=HzBus20090714;Asynchronous Processing=true";
if (sList.Count > 0)
{
for (int i = 0; i < sList.Count; i++)
{
double _x = 0;
double _y = 0;
string strname = sList[i].FName;
string strmark = sList[i].FExternalMark;
string strcatalog = sList[i].FCatalog;
SGis.SGeometry.SPoint xPoint = SGis.SGeometry.SPoint.FromStringBySpace(HzBLib.Common.ConvertByteArrayToString(sList[i].FShapeRoad));
SGis.SGeometry.SPoint xPoint1 = SGis.SGeometry.SPoint.FromStringBySpace(HzBLib.Common.ConvertByteArrayToString(sList[i].FShapeGps));
if (xPoint != null)
{
_x = xPoint.X;
_y = xPoint.Y;
}
else if (xPoint1 != null)
{
_x = xPoint1.X;
_y = xPoint1.Y;
}
else
{
_x = 0;
_y = 0;
}
SqlConnection conn = new SqlConnection(strconn);
string strsql = "insert into Copy_sbiz values('"+strname+"','"+strmark+"','"+_x+"','"+_y+"','"+ strcatalog +"')";
//SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
//DataSet ds = new DataSet();
//da.Fill(ds);
conn.Open();
SqlCommand comm = new SqlCommand(strsql, conn);
IAsyncResult a = comm.BeginExecuteNonQuery();
comm.EndExecuteNonQuery(a);
conn.Close();