Public Shared vertices() As String = {"Selandar", "ChinChin", "Jasin", "Merlimau"}
Public Shared edges(,) As Integer = {{0, 22, 16, 32}, {22, 0, 15, 26}, {16, 15, 0, 21}, {32, 26, 21, 0}}
as u can see...this is the distances that i want to keep in database..the problem is i have no idea on how to design it. could anyone please help me with this. what i got in my head is to design it like below, how can i transform this into the database?
|
|
Selandar |
Chin chin |
|
Selandar |
0 |
22 |
patrick stanyPosted Oct 30, 2007, 2:15 AM
Thanks for the same. its working thanks once again.
Patrick
ana alyPosted Oct 5, 2007, 10:23 PM
hello..sorry for the late reply
i had design the database..but it mostly looks like this
id places distance
1 Bukit Bintang -> Bukit Bintang 0
2 Bukit Bintang -> China Town 0.9
3 Bukit Bintang -> Chow Kit 2.1
id became the primary key..is it possible if i design it like this?? i plan to just change tha value of this
Public Shared edges(,) As Integer = {{0, 22, 16, 32}, {22, 0, 15, 26}, {16, 15, 0, 21}, {32, 26, 21, 0}}- change each value with the primary key...referring to database using primary key
so here i want to ask...could you teach me the code on how to connect to the database and referring the primary key as i stated above? please help me sir
Munir ShaikhPosted Sep 27, 2007, 3:29 AM
Hi again,
If you want to store comma seperated values in the table then the structure will change little bit
Create table tblxyz
(
Id int identity(1,1) Not null primary key,
vertices varchar(50) not null,
edges varchar(50)
)
Enjoy!
>>Munnamax
Munir ShaikhPosted Sep 27, 2007, 3:12 AM
Hi,
As per the bottom table image i think it is simple to do it here i am giving you small code
If you want to store the vertices wise edges the i think the structure should be as below
Create table tblxyz
(
Id int identity(1,1) Not null primary key,
vertices varchar(50) not null,
edges int
)
Where Id is any Id which is acting as auto increment and also as primary key, so while inserting record you will only insert vertices and edges
if you want to store all the edges then it will change as below
Create table tblxyz
(
Id int identity(1,1) Not null primary key,
vertices varchar(50) not null,
edge1 int,
edge2 int,
edge3 int,
edge4 int
)
Since you have four edges for single vertices
Regards,
>>Munnamax