classic asp can't connect sql server [Answered]RSS

2 replies

Last post Oct 23, 2017 07:17 AM by Yuk Ding

  • classic asp can't connect sql server

    Oct 22, 2017 02:06 PM|jimschan|LINK

    Hi,

    I'm testing this code to connect sql server, but the page didn't savethe data to sql server. Is there any configuration that I need to set to enable the connection?

    <body>
    <form name="Form" action="*.asp" method="post">
    <input name="Name" type="text"><br>
    <input name="Password" type="password"><br>
    <input  type="submit">
    </form>
    </body>
    </html>

    <%
     dim sql
     sql ="select * from table-name "
     set conn=server.createobject("adodb.connection")
     conn.open "provider=sqloledb;source=local;uid=sa;pwd=*******;database=db-name"
     set rs=server.createobject("adodb.recordset")
     rs.open sql,conn,3,2
     rs.addnew
     rs("name")=request.form("Name")
     rs("pwd")=request.form("Password")
     rs.update
    %>
  • Rovastar Rovastar

    5431 Posts

    MVP

    Moderator

    Re: classic asp can't connect sql server

    Oct 22, 2017 11:06 PM|Rovastar|LINK


    <br>
    https://www.connectionstrings.com is a good site for showing different ways of connecting to a db.&lt;br&gt;<br>
    Also check for any errors. &lt;br&gt;<br>
    Not working isn't very useful there will be errors in the IIS logs, event log, SQL server logs, etc&lt;br&gt;<br>
    Make sure you see communication to the SQL server. Check firewalls, etc allow connections through to it.&lt;br&gt;<br>
    &lt;br&gt;<br>
    Oh do not use sa as your account to connect up your db setup a less privileged account.<br>
    Troubleshoot IIS in style
    https://www.leansentry.com/
  • Re: classic asp can't connect sql server

    Oct 23, 2017 07:17 AM|Yuk Ding|LINK

    Hi jimschan,

    I didn't find any error which is related to the display of database data in form. So maybe you need to check the connections between IIS and sql server. Just ensure your connection string could be accessed. Please check sql server authentication log could help you fix this issue. In IIS, you should not require to configure anything unless you need to use IIS connection string.

    Bes Regards,

    Yuk Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.