指標資料庫連結 |
尚未結案
|
liyanzi
一般會員 發表:51 回覆:45 積分:19 註冊:2005-01-24 發送簡訊給我 |
請問各位大大~
最近有嘗試連接資料庫了~~不過還是遇到很大的問題
已有將程式上傳至會員求助區了 我在資料庫中~~分別有number、an_road_numeral、
roadname、road_numeral、road、an_road、head、temp這些欄位 在head欄中~~就只有成功路一欄為1,剩下為0 而number是按照順序, temp成功路(第一列)那列為0,而就從0.1.2.3...順序排下來 an_road_numeral:另一條連接道路的距離
roadname:路名
road_numeral:連接道路的距離
road:連接道路的節點號碼
an_road:另一條連接道路的節點號碼 整個小型路網圖為下:
如果我以下原本的路徑資料的話 for ( int i = 0; i < 10; i++ )
delete_road[ i ] = new Save_roadname ;
head = new DList ;//先將其設為NULL
find_head = new DList ;
for ( int i = 0; i < 10; i++ )
temp_road[ i ] = new DList ;
all_num = 0 ;
DList *pointer, *temp[10] ;
for ( int i = 0; i < 10; i++ )
temp[ i ] = new DList ; head -> number = 1 ;
head -> roadname = "成功路" ;
ComboBox1 -> Items -> Add( head -> roadname ) ;
head -> road = temp[ 0 ] ; // 成功 -> 自由
head -> road_numeral = 35 ;
head -> an_road = NULL ; // 無
head -> an_road_numeral = 0 ; temp[ 0 ] -> number = 2 ;
temp[ 0 ] -> roadname = "自由路" ;
ComboBox1 -> Items -> Add( temp[ 0 ] -> roadname ) ;
temp[ 0 ] -> road = temp[ 1 ] ; // 自由 -> 博愛
temp[ 0 ] -> road_numeral = 45 ;
temp[ 0 ] -> an_road = temp[ 2 ] ; // 自由 -> 中正
temp[ 0 ] -> an_road_numeral = 30 ; temp[ 1 ] -> number = 3 ;
temp[ 1 ] -> roadname = "博愛路" ;
ComboBox1 -> Items -> Add( temp[ 1 ] -> roadname ) ;
temp[ 1 ] -> road = temp[ 3 ] ; // 博愛 -> 仁愛
temp[ 1 ] -> road_numeral = 25 ;
temp[ 1 ] -> an_road = NULL ; // 無
temp[ 1 ] -> an_road_numeral = 0 ; temp[ 2 ] -> number = 4 ;
temp[ 2 ] -> roadname = "中正路" ;
ComboBox1 -> Items -> Add( temp[ 2 ] -> roadname ) ;
temp[ 2 ] -> road = temp[ 3 ]; // 中正 -> 仁愛
temp[ 2 ] -> road_numeral = 45 ;
temp[ 2 ] -> an_road = temp[ 4 ]; // 中正 -> 中山
temp[ 2 ] -> an_road_numeral = 130 ; temp[ 3 ] -> number = 5 ;
temp[ 3 ] -> roadname = "仁愛路" ;
ComboBox1 -> Items -> Add( temp[ 3 ] -> roadname ) ;
temp[ 3 ] -> road = temp[ 4 ] ; // 仁愛 -> 中山
temp[ 3 ] -> road_numeral = 100 ;
temp[ 3 ] -> an_road = temp[6] ; // 仁愛->安和
temp[ 3 ] -> an_road_numeral = 70 ; temp[ 4 ] -> number = 6 ;
temp[ 4 ] -> roadname = "中山路" ;
ComboBox1 -> Items -> Add( temp[ 4 ] -> roadname ) ;
temp[ 4 ] -> road = NULL;//無
temp[ 4 ] -> road_numeral = 0
temp[ 4 ] -> an_road = NULL ; // 無
temp[ 4 ] -> an_road_numeral = 0 ; 那我要這些資料要連資料庫怎麼寫阿?? head->number=1的話 資料庫指令要怎麼寫呢 head 是指標的意思哦??
|
liyanzi
一般會員 發表:51 回覆:45 積分:19 註冊:2005-01-24 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |