Thursday, February 9, 2012

Asp.net / sql help

ok first satrt with asp .net as this is simple or should be

< %# DataBinder.Eval(Container.DataItem, "Price", "{0:c}") %>
the {0:c} defines it to 2 decimal palces and i assume as a currency

now i have a short date one but it displays the time as well obviousley time is just 00:00:00 but was is the mask for it?

< %# DataBinder.Eval(Container.DataItem, "Date", "?mask??") %
ok now for sql i have 3 tables as follow
[code]

[SIZE=3]Education[/SIZE]
edId - primary key
edSchool
edDateBegin
edDateEnd

[SIZE=3]EducationLevel[/SIZE]
edId – foreign key link
lvlId – primary key
Level

[SIZE=3]EducationMarks[/SIZE]
lvlId – foreign key link
lvlname
Description
[/code]

And at the minute have got it working like this
[code]
ALTER PROCEDURE GetMarks

AS

SELECT edSchool, edDatebegin, edDateEnd,
EducationLevel.level
FROM Education INNER JOIN EducationLevel
ON Education.edID = EducationLevel.edID

RETURN
[/code]

How do i include the third table in it?
i tried this but syntax errors on the 2nd on statment

[code]

ALTER PROCEDURE GetMarks

AS

SELECT edSchool, edDatebegin, edDateEnd,
EducationLevel.level, EducationMark.lvlName, EducationMark.Description
FROM Education INNER JOIN EducationLevel INNER JOIN EducationMark
ON Education.edID = EducationLevel.edID and EducationLevel.lvlid = EducationMark.lvlId

RETURN

[/code]

Any help Much apreciated.Try

ALTER PROCEDURE GetMarks

AS

SELECT edSchool, edDatebegin, edDateEnd,
EducationLevel.level, EducationMark.lvlName, EducationMark.Description
FROM Education INNER JOIN EducationLevel ON Education.edID = EducationLevel.edID INNER JOIN EducationMark on EducationLevel.lvlid = EducationMark.lvlId

RETURN

|||thx got that working i just cant figure out how to get it. i need a list in a list how the hell do you do this i cant get my head round it.

i have 3 tables as above the middle one just being a joining table so you dont have many to many relationships. now i want to display it as below

Title1
content 1
content 2
content 3

Title 2
blah 1
blah 2
blah 3

Title 4
ex 1
ex 2
ex 3

Ect ect

But im using a datalist template item but that only does 1 list not a list inside a list so i get the following

Title1 - content 1
Title1 - content 2
Title1 - content 3
Title1 - content 4

Title 2 - blah 1
Title 2 - blah 2
Title 2 - blah 3

Ect ect can any1 help or give me a link which expalins how to do this thanx

No comments:

Post a Comment