嗨我正在研究項目車輛跟蹤系統我想生成停工報告它工作正常與PHP和EXTJS,但現在正在改變項目爲ASP .net與C#。我有4個不同的查詢來顯示報告,但在asp.net gridview我如何綁定所有4個不同的查詢顯示在GridView與分頁。如何在asp.net中用c#在車輛跟蹤系統中生成停工報告
這是我的PHP代碼
$NewID = "";
$OldID = "";
//echo("Select gps_id,lat,lon,tdate,ttime,tdate_time,speed,lname from gps_data where vehicle_no = '$vno' and (CONVERT(tdate_time, DATETIME) between '$FromDate' and '$ToDate') and speed > 1 order by gps_id asc");
$sql1 = mysql_query("Select gps_id,latitude,longtitude,get_date,get_time,get_date_time,speed,location from gps_data where device_id = '$device_id' and host_name = '". $host ."' and (CONVERT(get_date_time, DATETIME) between '$FromDate' and '$ToDate') and speed > 1 order by gps_id asc");
while($row = mysql_fetch_row($sql1))
{
$NewID = $row[0];
//echo($OldID);
if($OldID > 0)
{
// echo("Select CONVERT(tdate_time, DATETIME) from gps_data where gps_id = ". $OldID ."");
$query = mysql_query("Select get_date_time,date_time from gps_data where gps_id = ". $OldID ." and host_name = '". $host ."'");
if($result = mysql_fetch_row($query))
{
$show_old_get_date_time = $result[0];
$old_get_date_time = $result[1];
//echo($old_get_date_time);
}
$query1 = mysql_query("Select get_date_time,date_time from gps_data where gps_id = ". $NewID ." and host_name = '". $host ."'");
if($result1 = mysql_fetch_row($query1))
{
$show_new_get_date_time = $result1[0];
$new_get_date_time = $result1[1];
}
//echo("Select gps_id,lat,lon,tdate,ttime,tdate_time,speed,lname from gps_data where vehicle_no = '$vno' and gps_id > ". $OldID ." and gps_id < ". $NewID ." and (CONVERT(tdate_time, DATETIME) between '$FromDate' and '$ToDate') order by gps_id asc");
$sql2 = mysql_query("Select gps_id,latitude,longtitude,get_date,get_time,get_date_time,speed,location from gps_data where device_id = '$device_id' and host_name = '". $host ."' and gps_id > ". $OldID ." and gps_id < ". $NewID ." and (CONVERT(get_date_time, DATETIME) between '$FromDate' and '$ToDate') order by gps_id asc");
if($rowA = mysql_fetch_row($sql2))
{
$NewLoc = parseD($rowA[7]);
//echo("SELECT TIMEDIFF('". $new_get_date_time ."','". $old_get_date_time ."')");
$sql3 = mysql_query("SELECT TIMEDIFF('". $new_get_date_time ."','". $old_get_date_time ."')");
if($rowB = mysql_fetch_row($sql3))
{
$cnt = $cnt + 1;
$DTDiff = $rowB[0];
$strBld .= $comm."{slno:\"". $cnt ."\",get_date:\"". $rowA[3] ."\",get_date_time:\"". $show_old_get_date_time." "."-"." ". $show_new_get_date_time ."\",stoppedTm:\"". $DTDiff ."\",loc_name:\"". $NewLoc ."\",latitude:\"".$rowA[1]."\",longitude:\"".$rowA[2]."\"}";
$comm = ",";
}
} //while($rowA = mysql_fetch_row($sql2))
} //if($OldID > 0)
$OldID = $row[0];
//echo($OldID);
} //while($row = mysql_fetch_row($sql1))
嗨,歡迎來到SO。您能夠提供迄今爲止在您的ASP移植代碼中的內容,以便人們可以看到發生了什麼問題? – Dutts 2013-04-08 10:42:31