/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
Udfyldelse af checkbox fra db
Fra : Carsten Pinderup


Dato : 11-06-01 20:34

Hvordan udfyldes en checkbox fra en DB. Jeg har prøvet lidt af hvert men
uanset hvad bliver chekboxen udfyldt, så jeg gøre et eller andet forkert
(men hvad det er jo ikke første gang) kan nogen hjælpe?





 
 
Jakob Andersen (11-06-2001)
Kommentar
Fra : Jakob Andersen


Dato : 11-06-01 20:28

"Carsten Pinderup" <carsten_pinderup@hotmail.dk> wrote in message
news:9g35ut$8tf$1@sunsite.dk...
> Hvordan udfyldes en checkbox fra en DB. Jeg har prøvet lidt af hvert men
> uanset hvad bliver chekboxen udfyldt, så jeg gøre et eller andet forkert
> (men hvad det er jo ikke første gang) kan nogen hjælpe?

Jege går udfra at du bruger et BIT felt.

If objRS("Felt") Then
Response.write "<input type=""checkbox"" CHECKED>"
Else
Response.write "<input type=""checkbox"">"
End if

--
Jakob Andersen
FAQ for webdesign gruppen på
<http://www.usenet.dk/oss/dk.edb.internet.webdesign>
"Det er rart at være vigtig, men det er vigtigere at være rar "



Brian H. Madsen - Pc~ (12-06-2001)
Kommentar
Fra : Brian H. Madsen - Pc~


Dato : 12-06-01 03:39

Hey,
Sorry but i have to write this in english (don't have a danish keyboard)..

To fill out a checkbox from a value in a database it first off depends on
what format the field is in the DB..

But you can manipulate this string to suit whatever format you're going to
use

IF rsMyRS.Fields.Item("fieldname").Value = TRUE THEN
Response.write "<input type=""checkbox"" CHECKED>
ELSE
Response.write "<input type=""checkbox"">
END IF

Just make sure that the format is either a yes/no (boolean) or simply just
a text field, then insert the value TRUE/FALSE into the db IF the checkbox
is checked...

Hope this helps..

Brian



Jakob Andersen (12-06-2001)
Kommentar
Fra : Jakob Andersen


Dato : 12-06-01 08:34

"Brian H. Madsen - PcPlus Web Design" <brian@pluswebdesign.com.au> wrote in
message news:3b257ee9$0$29060@echo-01.iinet.net.au...
> But you can manipulate this string to suit whatever format you're going to
> use
>
> IF rsMyRS.Fields.Item("fieldname").Value = TRUE THEN
> Response.write "<input type=""checkbox"" CHECKED>
> ELSE
> Response.write "<input type=""checkbox"">
> END IF

Hvordan adskiller det sig fra den kode jeg sendte?

> Just make sure that the format is either a yes/no (boolean) or simply
just
> a text field, then insert the value TRUE/FALSE into the db IF the checkbox
> is checked...

Hvis det er et tekstfelt skal du have gåseøjne omkring TRUE
--
Jakob Andersen
FAQ for webdesign gruppen på
<http://www.usenet.dk/oss/dk.edb.internet.webdesign>
"Det er rart at være vigtig, men det er vigtigere at være rar "



Brian H. Madsen - Pc~ (12-06-2001)
Kommentar
Fra : Brian H. Madsen - Pc~


Dato : 12-06-01 12:45

Uhmmmm...take a closer look at the code and i'm sure you will find a rather
LARGE difference in those two codes.

****yours****
If objRS("Felt") Then <<<<<<<< is there something missing here ??
Response.write "<input type=""checkbox"" CHECKED>"
Else
Response.write "<input type=""checkbox"">"
End if

****mine****
IF rsMyRS.Fields.Item("fieldname").Value = TRUE THEN
Response.write "<input type=""checkbox"" CHECKED>"
ELSE
Response.write "<input type=""checkbox"">"
END IF


If you left out that part on purpose i would really not have any idea as to
how your skills with ASP is, so i merely tried to point out a small
difference that 'could' change the outcome of the code.




Kim Jensen (12-06-2001)
Kommentar
Fra : Kim Jensen


Dato : 12-06-01 13:05

> Uhmmmm...take a closer look at the code and i'm sure you will find a
rather
> LARGE difference in those two codes.

"Large" betyder "stor".

> ****yours****
> If objRS("Felt") Then <<<<<<<< is there something missing here ??
> ****mine****
> IF rsMyRS.Fields.Item("fieldname").Value = TRUE THEN

Og forklar så, hvori forskellen består? (ud over at din løsning er unødigt
kompliceret)

> If you left out that part on purpose i would really not have any idea as
to
> how your skills with ASP is, so i merely tried to point out

"Skills" er flertal, hvorfor du skal skrive "are" og ikke "is". Hvis du har
skrevet "is" med vilje, tør jeg ikke gætte på dine færdigheder inden for det
engelske sprog. Desuden skrives "I" altid med stort.

> ...a small difference that 'could' change the outcome of the code.

"Small" betyder "lille". Du sagde ovenfor, at der var stor ("large")
forskel.


Bemærk: Denne mail skal ikke læses som en flame e.l., men blot illustrere
hvor lidt udbytte din egen posting gav. Du siger, at noget er rigtigt og
noget er forkert - men uden at forklare hvorfor. Derudover sætter du
spørgsmålstegn ved Jakobs evner inden for ASP, uden at fortælle, hvad han
gør galt.


mvh
Kim Jensen



Brian H. Madsen - Pc~ (12-06-2001)
Kommentar
Fra : Brian H. Madsen - Pc~


Dato : 12-06-01 14:43

Thanks for the English lesson....wouldn't have noticed the mistakes (and
properly not cared either).

I couldn't help but notice that you mentioned your post wasn't meant to be
inflaming. If that really was the case then why even bother mentioning my
English errors ? Was it just to appear a smartarse ?

Also noticed that you contributed absolutely nothing to this thread, except
to appear as a small (and yes in this case small means small) know-it-all.

I was trying to help Jakob out but it appears that you took quite some
offence to my offered help and started ragging my English. Very inventive of
you. So unless you have anything to contribute (regarding ASP) please spare
me the condescending attitude. Maybe you haven't heard the saying 'Only
conceited people need to be condescending'. If the meaning passes you, maybe
you should look into your divine knowledge and find the answer there.

Whilst your gramatical English may be correct persay, your conversational
English stinks!

Also, I never once in my post claimed that my solution was correct and that
Jakob's was wrong. I do not know where in my post you made that assumption.

oh..and btw...this post isn't meant to be inflaming either.

And for your information, this post is NOT condescending in tone, rather it
is "matter of fact" (this is an English saying).

(ogsaa en lille dansk time. "flame" ??? mener du flamme ?? eller
"Inflamatory" (btw..that's English) - og
" e.i " ??? Mener du ikke " ie. " ???) Maaske skulle du kigge lidt i dine
egne buske foer du kaster dig efter mig ?




Kim Jensen (12-06-2001)
Kommentar
Fra : Kim Jensen


Dato : 12-06-01 15:03

>I couldn't help but notice that you mentioned your post wasn't meant to be
>inflaming. If that really was the case then why even bother mentioning my
>English errors ? Was it just to appear a smartarse ?

Som du også kunne læse af mit indlæg var det alene tænkt til at understrege,
hvor ubrugeligt DIT indlæg var.

>Also noticed that you contributed absolutely nothing to this thread, except
>to appear as a small (and yes in this case small means small) know-it-all.

Nu bad jeg dig jo egentlig om at fremføre argumenter for, hvorfor der var så
stor forskel mellem dit og Jakobs indlæg. Det har du endnu ikke gjort. Kan
du?

>Whilst your gramatical English may be correct persay, your conversational
>English stinks!

Nej, nu ryster jeg altså i bukserne!

>Also, I never once in my post claimed that my solution was correct and that
>Jakob's was wrong. I do not know where in my post you made that assumption.

Du sagde da, at der var STOR forskel mellem de to løsningers udfald. Det er
måske ikke tilfældet alligevel?

>And for your information, this post is NOT condescending in tone, rather it
>is "matter of fact" (this is an English saying).

Se f.eks. http://www.usenet.dk
"Flame" et et almindeligt brugt udtryk på usenet.

>" e.i " ??? Mener du ikke " ie. " ???) Maaske skulle du kigge lidt i dine
>egne buske foer du kaster dig efter mig ?

Hvis du kunne læse, ville du se, at der stod "e.l." som er en almindelig
dansk forkortelse for "eller lignende".


Med venlig hilsen
Kim Jensen



Brian H. Madsen - Pc~ (13-06-2001)
Kommentar
Fra : Brian H. Madsen - Pc~


Dato : 13-06-01 04:59

Kim,

The only thing I can say to your reply is that you apparently feels
obligated in some way to display the superiority you yourself have found in
your skills.

And to answer your question regarding the differences in those two codes. I
have on occasion had some trouble with objRS("Field") where the outcome
haven't always been satisfactory. I tend to be more specific in my coding
than to rely on default settings (eg. TRUE/YES being default values). You
probably have another coding habit, which I'm not going to judge(though you
felt conceited enough to correct me in my coding habit) but since you still
haven't addressed the overall topic with anything I think you should simply
just let it rest or add your own input to it.

In aspects of commonly used deviations on usenet.dk I can say that I have
never visited usenet.dk and access this newsgroup/forum from Australia so
would not have known that the English word "flame" was used in context with
your Danish (though as you might not have noticed, your initial post was
inflamable regardless of the off-hand comment that it wasn't).

So for sake of your ego and need of testosterone flow, either contribute to
this thread's topic or let it rest.

Brian



Jakob Andersen (12-06-2001)
Kommentar
Fra : Jakob Andersen


Dato : 12-06-01 14:50

"Brian H. Madsen - PcPlus Web Design" <brian@pluswebdesign.com.au> wrote in
message news:3b25fecd$0$29052@echo-01.iinet.net.au...

> Uhmmmm...take a closer look at the code and i'm sure you will find a
rather
> LARGE difference in those two codes.

Der er en forskel, nemlig at min er en halvgardering.. Vi er forhåbentlig
enig om dette:

True = 1
False = 0

Din kode vil have koden som lige netop værdien True og accepterer ikke 1,
derfor kan min måde ofte være god i sammenhæng med en Database med et felt
der netop antager værdien 1 eller 0 istedet for False/True

En dårlig ting ved min kode er så at det betragter -1 som true så hvis man
skal være helt sikker skal man bruge følgende:

If boolean and boolean <> -1 Then

> If you left out that part on purpose i would really not have any idea as
to
> how your skills with ASP is, so i merely tried to point out a small
> difference that 'could' change the outcome of the code.

hmmm... Jeg ville ikke sige at jeg er verdens bedste ASP-koder men
ovenstående kode er der da ikke noget galdt med!

--
Jakob Andersen
FAQ for webdesign gruppen på
<http://www.usenet.dk/oss/dk.edb.internet.webdesign>
"Det er rart at være vigtig, men det er vigtigere at være rar "





Brian H. Madsen - Pc~ (13-06-2001)
Kommentar
Fra : Brian H. Madsen - Pc~


Dato : 13-06-01 15:26

Yes I agree with you totally on that point...Unfortunately I assumed that
the field was formatted as TRUE/FALSE...instead of 1/0....I have just
checked my code with some other ASP-coders and they did say that mine had
the exact error (if you can call it an error) that you just now pointed out.
It works IF, and only IF, the field in the database is formatted for
TRUE/FALSE...

If yours are working regardless of format please let me know as I'm always
looking for ways to improve my own coding habits, and skills of course.

Anyways, .good luck with it...

Brian



Søg
Reklame
Statistik
Spørgsmål : 177557
Tips : 31968
Nyheder : 719565
Indlæg : 6408878
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste