get info from 2 tables with 2 condition

Discussion in 'ASP General' started by PeterL, May 2, 2004.

  1. PeterL

    PeterL Guest

    Hello,
    as you can see from preveous postings I want accompish:
    1) from tblVetskebalans
    http://www12.brinkster.com/vatskebalans/tblvetskebalans11.asp
    for each PatID (= personnummer) = Request.Form("rapport")
    get:(e.g)
    date Fluidsname (=vätskor) Volym
    2003-12-20 Glukos buffrad 1 23456
    Albumin 40 mg/ml 1234
    Blod 333
    2003-12-22 Glukos 50 mg/ml + EL 403

    and from tblPersonuppgifter get
    PatID (= personnummer) = Request.Form("rapport")
    ftEnamn
    ftFnamn
    I´ve tried this code:
    Code:
     <%
    Set vbalans = Server.CreateObject("ADODB.Connection")
    vbalans.Provider = "Microsoft.Jet.OLEDB.4.0"
    MdbFilePath = Server.MapPath("\vatskebalans\db\vbalans.mdb")
    vbalans.ConnectionString = "Data Source='" & MdbFilePath & "'"
    vbalans.open
    strSQL = "SELECT tblFluids.FluidNamn, tblFluids.FluidID,
    tblVetskebalans.Dag," & _
    " tblVetskebalans.PatID AS patid, tblVetskebalans.FluidID,
    tblVetskebalans.Energi," & _
    " tblVetskebalans.Volym, tblPersonuppgifter.PatID AS ID,
    tblPersonuppgifter.ftFnamn," &_
    " tblPersonuppgifter.ftEnamn FROM tblVetskebalans, tblFluids,
    tblPersonuppgifter WHERE" &_
    " tblPersonuppgifter.PatID = "&Request.Form("rapport")&" AND
    tblVetskebalans.PatID = tblVetskebalans.Dag ORDER by Dag ASC"
    Set rs1 = vbalans.Execute (strSQL)
    Response.Write "<BR><B>" & strSQL & "</B><P>"
    'formatera till svensk personnummer
    Function SvPnr(txt)
    personnummer =Left(txt,6) & " - " & Right(txt,4)
    SvPnr = personnummer
    End Function
    Response.Write SvPnr(rs1("ID")) & "<BR>"
    Response.Write "<B>" & rs1("ftEnamn") & ", " & rs1("ftFnamn") &
    "</B><P><P><P>"
    %>
    <TABLE border=1>
    <TR>
    <TD><B>Datum</B></TD>
    <TD><B>Vätska</B></TD>
    <TD><B>Volym</B></TD>
    <TD><B>Energi</B></TD>
    </TR>
    <%
    Do While Not rs1.EOF
    Response.Write "<TR><TD>" & rs1("Dag") & "</TD>"
    Response.Write "<TD>" & rs1("FluidNamn") & "</TD>"
    Response.Write "<TD>" & rs1("Volym") & "</TD>"
    Response.Write "<TD>" & rs1("Energi") & "</TD></TR>"
    rs1.MoveNext
    Loop
    vbalans.Close
    Set vbalans = Nothing
    %>
    butkeepgetting only errors:
    error '80020009'

    Please help me - I starting to lose my mind, and can´t sleep for
    several nights now...
    thx in advance
    any help will be appriciated
    /Peter
    PeterL, May 2, 2004
    #1
    1. Advertising

  2. PeterL

    Bob Barrows Guest

    PeterL wrote:
    > Hello,
    > as you can see from preveous postings I want accompish:

    I've already answered this in your first thread. Instead of starting a new
    thread, please reply to my post in your original thread and tell me why my
    answer did not solve your problem. Perhaps I can offer futher suggestions.
    Starting new threads for the same problem is extremely counter-productive.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows, May 2, 2004
    #2
    1. Advertising

  3. PeterL

    PeterL Guest

    "Bob Barrows" <> wrote in message news:<>...
    > PeterL wrote:
    > > Hello,
    > > as you can see from preveous postings I want accompish:

    > I've already answered this in your first thread. Instead of starting a new
    > thread, please reply to my post in your original thread and tell me why my
    > answer did not solve your problem. Perhaps I can offer futher suggestions.
    > Starting new threads for the same problem is extremely counter-productive.
    >
    > Bob Barrows


    Sorry Bob, I´ll never do that again
    PeterL, May 2, 2004
    #3
  4. PeterL

    PeterL Guest

    "Bob Barrows" <> wrote in message news:<>...
    > PeterL wrote:
    > > Hello,
    > > as you can see from preveous postings I want accompish:

    > I've already answered this in your first thread. Instead of starting a new
    > thread, please reply to my post in your original thread and tell me why my
    > answer did not solve your problem. Perhaps I can offer futher suggestions.
    > Starting new threads for the same problem is extremely counter-productive.
    >
    > Bob Barrows


    Sorry Bob, I´ll never do that again
    PeterL, May 2, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vasanth
    Replies:
    0
    Views:
    528
    Vasanth
    Jun 28, 2004
  2. -
    Replies:
    12
    Views:
    675
    Remon van Vliet
    Jun 15, 2005
  3. Chris Brat
    Replies:
    5
    Views:
    687
    =?iso-8859-1?q?Luis_M._Gonz=E1lez?=
    Aug 22, 2006
  4. ilya

    get CPU info, RAM info

    ilya, Apr 8, 2010, in forum: Java
    Replies:
    43
    Views:
    5,926
    Mike Schilling
    Apr 19, 2010
  5. Bill W.
    Replies:
    13
    Views:
    277
    Phillip Gawlowski
    May 9, 2011
Loading...

Share This Page