Professional Web Applications Themes

conn.open problem on client, not on server - ASP Database

I'm struggling with this problem waaaaay to long... i want to generate a letter when a button is clicked on my page. Ms Word should be opened and you should be able to see the doent filling up as the code executes... this is the script i wrote: <script language="vbscript"> dim objword Sub OpenDoc() dim Objword dim rs, conn, Sql, Rs2, Sql2, Nummer set Conn = createobject("ADODB.Connection") set Rs = createobject("ADODB.Recordset") set Rs2 = createobject("ADODB.Recordset") set objword = createobject("Word.application") objword.visible = true objword.doents.add "C:\Diensthoofd_hartrev.dot" objdoc = objword.activedoent ' conn.Open "DSN=TAFTEN;UID=Administrator;PWD=test" 'Sql = "Select * from onderzoeken where onderzoeksnummer = '040607-3EF'" ...

  1. #1

    Default conn.open problem on client, not on server

    I'm struggling with this problem waaaaay to long...

    i want to generate a letter when a button is clicked on my page. Ms
    Word should be opened and you should be able to see the doent
    filling up as the code executes...

    this is the script i wrote:

    <script language="vbscript">
    dim objword

    Sub OpenDoc()

    dim Objword
    dim rs, conn, Sql, Rs2, Sql2, Nummer
    set Conn = createobject("ADODB.Connection")
    set Rs = createobject("ADODB.Recordset")
    set Rs2 = createobject("ADODB.Recordset")

    set objword = createobject("Word.application")
    objword.visible = true
    objword.doents.add "C:\Diensthoofd_hartrev.dot"
    objdoc = objword.activedoent

    '
    conn.Open "DSN=TAFTEN;UID=Administrator;PWD=test"
    'Sql = "Select * from onderzoeken where onderzoeksnummer =
    '040607-3EF'"

    'rs.Source = sql
    'rs.ActiveConnection = conn
    'rs.Open

    'objword.selection.typeparagraph
    'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Aan Prof. Dr. Seppen"
    'objword.selection.typeparagraph
    'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Cardiologie"
    'objword.selection.typeparagraph
    'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Alhier De joskens 185"
    'objword.selection.typeparagraph
    'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "9000 Gavere"
    'objword.selection.typeparagraph
    'objword.selection.typeparagraph
    'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Gavere, 16 juli 2004"
    'objword.selection.typeparagraph
    'objword.selection.typeparagraph
    'objword.selection.typetext "Geachte Collega,"

    on the server this works perfectly... but when i request the page from
    a client-machine on the same domain and clicked the button, a
    worddoent was opened but further nothing happened. on the bottom of
    my page a yellow !-sign tells me '"error on page", nothing more... by
    putting the rest of my code between ' i know that the error is in the
    line: "conn.Open "DSN=TAFTEN;UID=Administrator;PWD=secret""
    Tim. D Guest

  2. #2

    Default Re: conn.open problem on client, not on server

    You are mixing client-side and server-side concepts. I have never seen
    functional client-side code that connects to a database through a DSN. Is
    the user actually sitting on the server where the DSN/ASP pages are? If so,
    then ASP is probably not your best option here. If not, then how do you
    verify that each user has that DSN and has the appropriate word and access
    files on each machine?

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Tim. D" <tim.demooruzgent.be> wrote in message
    news:9db436e4.0408040623.72e06437posting.google.c om...
    > I'm struggling with this problem waaaaay to long...
    >
    > i want to generate a letter when a button is clicked on my page. Ms
    > Word should be opened and you should be able to see the doent
    > filling up as the code executes...
    >
    > this is the script i wrote:
    >
    > <script language="vbscript">
    > dim objword
    >
    > Sub OpenDoc()
    >
    > dim Objword
    > dim rs, conn, Sql, Rs2, Sql2, Nummer
    > set Conn = createobject("ADODB.Connection")
    > set Rs = createobject("ADODB.Recordset")
    > set Rs2 = createobject("ADODB.Recordset")
    >
    > set objword = createobject("Word.application")
    > objword.visible = true
    > objword.doents.add "C:\Diensthoofd_hartrev.dot"
    > objdoc = objword.activedoent
    >
    > '
    > conn.Open "DSN=TAFTEN;UID=Administrator;PWD=test"
    > 'Sql = "Select * from onderzoeken where onderzoeksnummer =
    > '040607-3EF'"
    >
    > 'rs.Source = sql
    > 'rs.ActiveConnection = conn
    > 'rs.Open
    >
    > 'objword.selection.typeparagraph
    > 'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    > chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Aan Prof. Dr. Seppen"
    > 'objword.selection.typeparagraph
    > 'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    > chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Cardiologie"
    > 'objword.selection.typeparagraph
    > 'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    > chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Alhier De joskens 185"
    > 'objword.selection.typeparagraph
    > 'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    > chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "9000 Gavere"
    > 'objword.selection.typeparagraph
    > 'objword.selection.typeparagraph
    > 'objword.selection.typetext chr(9) & chr(9) & chr(9) & chr(9) &
    > chr(9) & chr(9) & chr(9)& chr(9) & chr(9) & "Gavere, 16 juli 2004"
    > 'objword.selection.typeparagraph
    > 'objword.selection.typeparagraph
    > 'objword.selection.typetext "Geachte Collega,"
    >
    > on the server this works perfectly... but when i request the page from
    > a client-machine on the same domain and clicked the button, a
    > worddoent was opened but further nothing happened. on the bottom of
    > my page a yellow !-sign tells me '"error on page", nothing more... by
    > putting the rest of my code between ' i know that the error is in the
    > line: "conn.Open "DSN=TAFTEN;UID=Administrator;PWD=secret""

    Aaron [SQL Server MVP] Guest

  3. #3

    Default Re: conn.open problem on client, not on server



    i came up with this asp-page and client-side vbscript when i realized
    that server-side automation in asp.net is NOT a good idea... I was
    hoping the clientscript would enable the client to open word and connect
    to my (sql2000) DB, enabling me to generate the letter.

    I was programming on the servermachine and everything worked fine. When
    i first tried a to request the page from a client-machine (in the same
    intranet). The client opens the template (which is on all our
    computers) but then stops when i try to make the connection with my DSN.
    I have a working system DSN on my server that points to my sql database.

    i hope that this info makes my problem a little bit clearer.

    you said i was mixing client- and server-side concepts...

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Tjé Da Mo Guest

  4. #4

    Default Re: conn.open problem on client, not on server

    The DSN is being turned down by Microsoft according to
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/ado_deprecated_components.asp[/url]
    so I'd recommend against using it in your new project. A DSN is a
    server concept. In you idea you are using server side programing on a
    client machine, this is a major taboo. This is because the user may
    change your DSN and thus ruin the entire app you just made.

    Tjé Da Mo wrote:
    >
    > i came up with this asp-page and client-side vbscript when i realized
    > that server-side automation in asp.net is NOT a good idea... I was
    > hoping the clientscript would enable the client to open word and connect
    > to my (sql2000) DB, enabling me to generate the letter.
    >
    > I was programming on the servermachine and everything worked fine. When
    > i first tried a to request the page from a client-machine (in the same
    > intranet). The client opens the template (which is on all our
    > computers) but then stops when i try to make the connection with my DSN.
    > I have a working system DSN on my server that points to my sql database.
    >
    > i hope that this info makes my problem a little bit clearer.
    >
    > you said i was mixing client- and server-side concepts...
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!
    joker Guest

  5. #5

    Default Re: conn.open problem on client, not on server

    thanx for your reply again...
    i was able te to connect with the DSN but i will keep in mind what you
    said about the user changing the DSN... this could be a problem indeed
    :)

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Tjé Da Mo Guest

  6. #6

    Default Re: conn.open problem on client, not on server

    Don't forget that Microsoft has scheduled the use of ODBC (aka DSN) to
    be deprecated. This means that Microsoft believes that the use of DSN
    is no longer a good option. Thus I highly recommend against using it.

    I think you should redesign the project because of this fact.

    This site gives you some ideas on what you should be doing instead.

    [url]http://www.aspfaq.com/show.asp?id=2126[/url]

    It is the same site that linked over to the Deprecated Components of the
    MDAC.

    Tjé Da Mo wrote:
    > thanx for your reply again...
    > i was able te to connect with the DSN but i will keep in mind what you
    > said about the user changing the DSN... this could be a problem indeed
    > :)
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!
    joker Guest

Similar Threads

  1. Flash Webcam client <-> client (not client <-> server<-> client)
    By bivald in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: April 24th, 10:33 PM
  2. java client and .NET server problem
    By gordongekko in forum ASP.NET Web Services
    Replies: 1
    Last Post: March 16th, 11:40 PM
  3. Internal Server Error 500 When Creating Conn.
    By juniorbee in forum Dreamweaver AppDev
    Replies: 0
    Last Post: February 22nd, 02:51 PM
  4. Internal Server Error 500 When Creating Conn.
    By juancho2222 in forum Dreamweaver AppDev
    Replies: 0
    Last Post: February 21st, 08:25 PM
  5. CHAP authentication problem with Linux client to Win 2K VPN server
    By James Kimble in forum Linux Setup, Configuration & Administration
    Replies: 1
    Last Post: September 15th, 06:26 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139