Your Advert here
cure-real
Results 1 to 9 of 9

Thread: Desperate need of help with VBScript...

  1. #1
    Join Date
    Jun 2008
    Posts
    15,149
    Blog Entries
    8

    Desperate need of help with VBScript...

    I need help with a fairly simple query, but I need it in VBScript and know NOTHING about VBS at all. Can someone help me with converting an ASP query to a VBScript???

    Code:
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="Dsn=DSNDATA;uid=userid;pwd=password" ProviderName="System.Data.Odbc" SelectCommand="SELECT MFITEM.ITITEM, MFITEM.ITPKR, MFITEM.ITDESC, MFITEM.ITPACK, MFITEM.ITSIZE, IVITEM.IVQOHC, IVITEM.IVQOHU, MFITEM.ITBKCS
     
    FROM A10358DC.DTSDATA.IVITEM IVITEM, A10358DC.DTSDATA.MFITEM MFITEM
     
    WHERE MFITEM.ITITEM = IVITEM.IVITM# AND ((MFITEM.ITPRBK='Y') AND (MFITEM.ITACTV='Y')  AND (IVITEM.IVQOHC&gt;0) OR (MFITEM.ITPRBK='Y') AND (MFITEM.ITACTV='Y') AND (IVITEM.IVQOHU&gt;0))
     
    ORDER BY MFITEM.ITDESC">
                    </asp:SqlDataSource>
    This query is working now, but our new web platform want it in VBScript.

    Before anybody freaks out, I have changed everything that is important or could pose a security risk.
    Last edited by bdh; Mar 29th 2011 at 09:43 PM.
    For what mortal has ever heard the voice of the living God speaking out of fire, as we have, and survived? ~ Deuteronomy 5:26

    If you're not prepared to risk your very life for your "enemy" you have no right to speak to him of love. ~ Daughter

    Many say they are called... but I am pretty convinced that with many of them it was the wrong number. ~ Project Peter

  2. #2
    Join Date
    Jul 2002
    Location
    JNB, ZA
    Posts
    1,653

    Re: Desperate need of help with VBScript...

    Wow, this is a blast from the past. Thought I'd never see that horrid stuff again.

    If I remember correctly, opening a data object syntax works something like this
    Code:
    dim connection_string : connection_string = _
    "provider=microsoft.jet.oledb.4.0;" _
    & "data source=c:\bla_bla.mdb"
    dim conn : set conn = createobject("adodb.connection")
    conn.open connection_string
    and then to do a SELECT, something along these lines
    Code:
    dim sql : sql = "select id from table_name"
    dim rs : set rs = createobject("adodb.recordset")
    rs.cursorlocation = 3 'Use a client-side cursor
    rs.open sql, conn, 3, 3
    Wherever I find myself, there I am.
    Download Free Bibles or Read online
    Christian WebHosting


  3. #3
    Join Date
    Aug 2007
    Location
    Eze 15:2-7
    Posts
    10,935
    Blog Entries
    6

    Re: Desperate need of help with VBScript...

    Using regular VB you'd want something along the lines of this:

    dim DB as ADODB.Connection
    dim RS as ADODB.Recordset
    dim sql as string

    One of these commands, depending on whether you're using DSN or DSN-free connections, obviously put the appropriate driver in place if it's not Oracle
    DB.Open "DSN=(whatever);Server=(whatever);Uid=(whatever);P wd=(whatever);"
    DB.Open "Driver={Microsoft ODBC for Oracle};Server=(whatever);Uid=(whatever);Pwd=(what ever);"

    sql = "select fields from tables etc"
    set RS = DB.Execute(sql)
    It's been a while since I did VBScript as opposed to regular VB although from what I recall if you just remove the type definitions and replace the first three lines with "dim DB, RS, sql" you should be OK.
    1Jn 4:1 NKJV Beloved, do not believe every spirit, but test the spirits, whether they are of God; because many false prophets have gone out into the world.

    1Th 5:21-22 NKJV Test all things; hold fast what is good. (22) Abstain from every form of evil.




  4. #4
    Join Date
    Jul 2002
    Location
    JNB, ZA
    Posts
    1,653

    Re: Desperate need of help with VBScript...

    Quote Originally Posted by tango View Post
    Using regular VB you'd want something along the lines of this:
    yours looks better than mine. I think for me it's been too long
    Wherever I find myself, there I am.
    Download Free Bibles or Read online
    Christian WebHosting


  5. #5

    Re: Desperate need of help with VBScript...

    Quote Originally Posted by bdh View Post
    Wow, this is a blast from the past. Thought I'd never see that horrid stuff again.

    BDH, do you have nightmares about code? I get headaches thinking about it, and I know nothing anywhere near what you do. And I am dreading learning CSS style sheets, Which to you is probably like the old DOS.
    Note: By request I can only post and see the tech section of this forum. So don't respond to my posts in the other sections because I cannot see them so I cannot respond. You can PM me if you need to.
    My site: http://www.yecheadquarters.org/

  6. #6
    Join Date
    Jul 2002
    Location
    JNB, ZA
    Posts
    1,653

    Re: Desperate need of help with VBScript...

    Quote Originally Posted by ikester7579 View Post
    BDH, do you have nightmares about code? I get headaches thinking about it, and I know nothing anywhere near what you do. And I am dreading learning CSS style sheets, Which to you is probably like the old DOS.
    Not at all. Code I love ... favorites, in order of preference, being Perl, C, Pascal (which no one uses any more) & Assembler.

    But most if the other "code wannabes" I can't stand. In order of dislike Java, JavaScript, VB & VBS, C#, anything to do with .NET!! and yes, PHP.

    On all the tech boards I frequent I'm proudly anti-wannabee code and it ruffles a lot of feathers
    Wherever I find myself, there I am.
    Download Free Bibles or Read online
    Christian WebHosting


  7. #7
    Join Date
    Aug 2007
    Location
    Eze 15:2-7
    Posts
    10,935
    Blog Entries
    6

    Re: Desperate need of help with VBScript...

    Quote Originally Posted by bdh View Post
    Not at all. Code I love ... favorites, in order of preference, being Perl, C, Pascal (which no one uses any more) & Assembler.

    But most if the other "code wannabes" I can't stand. In order of dislike Java, JavaScript, VB & VBS, C#, anything to do with .NET!! and yes, PHP.

    On all the tech boards I frequent I'm proudly anti-wannabee code and it ruffles a lot of feathers
    Maybe not Turbo Pascal but I still positively love Delphi.
    1Jn 4:1 NKJV Beloved, do not believe every spirit, but test the spirits, whether they are of God; because many false prophets have gone out into the world.

    1Th 5:21-22 NKJV Test all things; hold fast what is good. (22) Abstain from every form of evil.




  8. #8
    Join Date
    Jul 2002
    Location
    JNB, ZA
    Posts
    1,653

    Re: Desperate need of help with VBScript...

    Quote Originally Posted by tango View Post
    Maybe not Turbo Pascal but I still positively love Delphi.
    Same here. In my "younger" days, spent a lot of time developing 805X firmware with this tool - http://www.ksc-softsys.com/pascalc.htm.
    Wherever I find myself, there I am.
    Download Free Bibles or Read online
    Christian WebHosting


  9. #9
    Join Date
    Aug 2007
    Location
    Eze 15:2-7
    Posts
    10,935
    Blog Entries
    6

    Re: Desperate need of help with VBScript...

    Quote Originally Posted by bdh View Post
    Same here. In my "younger" days, spent a lot of time developing 805X firmware with this tool - http://www.ksc-softsys.com/pascalc.htm.
    I remember the days when I taught myself 6502 assembly language and worked out how to play tunes with floppy disk drives by telling the heads to seek specific track sequences.

    Somewhere along the line I wrote a piece of code that destroyed one floppy, then destroyed the other floppy, then crashed the computer. Unfortunately it wasn't supposed to do anything like that, and I never did work out exactly what I'd messed up in the code.
    1Jn 4:1 NKJV Beloved, do not believe every spirit, but test the spirits, whether they are of God; because many false prophets have gone out into the world.

    1Th 5:21-22 NKJV Test all things; hold fast what is good. (22) Abstain from every form of evil.




Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Discussion Desperate?
    By Standing in forum Growing in Christ
    Replies: 3
    Last Post: Jun 5th 2010, 06:32 PM
  2. Desperate for help!
    By aychmb in forum Apologetics and Evangelism
    Replies: 5
    Last Post: Apr 22nd 2010, 12:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •