problem with db query, because of codeconverting - InfoPath Dev
in

InfoPath Dev

problem with db query, because of codeconverting

Last post 10-03-2006 09:18 AM by Matt Faus. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-26-2006 02:35 AM

    problem with db query, because of codeconverting

    Hi, i have got a little problem, so i had to change a whole (working) form from vbscript to jscript.
    Thing is, i wanted the form to show up in an email body as it looks like in infopath.
    i found out, that using vbscript i can not accomplish that (when i add xDocument.DOM.xml to the email body it just looks like rubbish)
    i also found out, that the stlye i need is easy to realize in jscript just as simple as:

    var oEnvelope = XDocument.View.Window.MailEnvelope;
    oEnvelope.To = "insertmailhere";
    oEnvelope.Visible = true;
    oEnvelope.Send = true;


    it looks great in the emails.

    so i had to create a new form, to make sure the language is jscript. but i have a problem to manage the database handlings i coded in vbscript.

    i need to convert this:


    Sub XDocument_OnLoad(eventObj)
    set conn = CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open "d:/folder/database.mdb"

    set rs=CreateObject("ADODB.recordset")
    set ts=CreateObject("ADODB.recordset")

    rs.Open "select * from Personal", conn, 3, 3
    dim temp, mail

    do while not rs.EOF
    if not isnull(rs.Fields("attributeA")) then
    set temp = rs.Fields("attributeA")
    ts.Open "select * from Personal", conn, 3, 3
    do while not ts.EOF
    if (ts.Fields("sname") = temp) then
    rs.Fields("emailname").value = ts.Fields("emailname").value
    if (master = "") then
    master = (master + ts.Fields("emailname").value)
    else master = (master + "; " + ts.Fields("emailname").value)
    end if
    end if
    ts.Movenext
    loop
    ts.close
    end if
    rs.Movenext
    loop
    rs.Close
    set rs = nothing
    End Sub


    into jscript

    :(

    don´t kill me if the code looks messy, i´m using vbscript for 1,5 weeks now, so it could be quite chaotic ^^


    the code does this:
    cycle through the db in search for the first object, that has an entry to attributeA
    cycle again to find the entry where name = attributeA
    set attributeA´s email-field to name´s email-entry
    the "master" variable is not important, it´s just for the .To field


    i have been quite glad to accomplish that within so little knowledge of the language, but now i need some help

    so i would like to ask some questions on jscript:

    how can i query the database for one special entry by cycling through the db (e.g. "search db for the entry, where name = dennis")
    i think ...movenext or nextNode() doesn´t work


    thanks
    dennis
  • 09-27-2006 02:24 AM In reply to

    Re: problem with db query, because of codeconverting

    okay got it almost complete
    took me 1 day of pure headache ^^
    but, you know, it´s worth it when it´s working :)

    just another useless post, sorry about that
  • 10-03-2006 09:18 AM In reply to

    Re: problem with db query, because of codeconverting

    Well, congratulations! It's great to hear you got it working!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.