Thursday 10 July 2014

Connectivity of HTML page with ASP page



 How amazing!!!

When all your data on web page store in a database. 

Let’s see the magic 



Step-1      "Activate Administrator Account using this command"

  •            For windows  8 press “Win+X” key and
         Select “command prompt (Admin)” or press 'a'



  • ·           For windows 7  go to start menu and search “cmd” and right  click on it and click run as administrator



    • After Starting CMD type


                  net user administrator /active:yes
       

  • Step-2      "Turn on all windows features"

     ·         Go to Control Panel->program and features->  












    •      Click Turn windows features or off and select  all features and press  ok.

                          Note- It needs an Internet connection .





    Step-3      "Activated required services"



    • Go to Control panel->
              Administrative Tool->Internet Information Services (IIS) Manager ->Asp  

    • ·         Double click on this option
       
    • ·         Click debugging properties and set send error to browser is True




      • ·         For 64 bit OS(Only windows 7 & 8 ) set following setting
                      Go to Control Panel->Administrative Tools->
                              Internet Information Services(IIS) Manager->
                              Application  Pool->DefaultAppPool->Advanced Setting->
         Set Enable 32-Bit Application is True
       
        After It Please restart your PC.




    Step-4    "Run Asp pages."

    Now your IIS 7or 8 is ready to run.



    Important Notes



    1)      When your IIS is turn on that time must turn off your Apache Server.

    2)      All asp pages save in “C:\inetpub\wwwroot\” this path or Create Virtual Directory for your other path.

    3)      All asp pages run on http://localhost/

    4)      For this connectivity you  must create ms-access database in .mdb extension (Microsoft Office Access Database 2002-2003).

    5)  This code not suported for MS-Access 2007 and above.

    6)      Set Database privileges as follows










    Connectivity Code


    Insert
    <html>
    <body>
    <%
    set con=Server.CreateObject("ADODB.Connection")

    con.provider="Microsoft.JET.OLEDB.4.0"
    con.open "C:\inetpub\wwwroot\Fashion_Corner\Database\FashionCorner.mdb"
    name1= Request.Form("name1")
    uname= Request.Form("uname")
    pass1=Request.Form("pass1")
    mobi=Request.Form("mobi")
    email1=Request.Form("email1")
    ans=Request.Form("ans")

    str="insert into Signup values('"& name1 &"','"& uname &"','"& pass1 &"','"& mobi &"','"& email1 &"','"& ans &"')"

    set rs=server.CreateObject("ADODB.Recordset")
    rs.open str,con
    If rs.state = 0 Then
    Response.write("record inserted successfully")
    End If
    set rs=nothing
    con.close
    set con=nothing
    %>
    </body>
    </html>


     
    SEARCH
    <html>
    <body>
    <%
    set con=Server.CreateObject("ADODB.Connection")
    con.provider="Microsoft.JET.OLEDB.4.0"
    con.open "C:\inetpub\wwwroot\Fashion_Corner\Database\FashionCorner.mdb"

    usname=Request.Form("usname")
    pass=Request.Form("pass")
    set rs = Server.CreateObject("ADODB.Recordset")
        rs.Open "SELECT password1 FROM Signup WHERE username='" & usname & "'", con
       
         for each x in rs.fields
            if x.value = pass then
                                        Response.write("record search successfully")
                    end if                      
         next
    rs.close
    con.close
    %>
    </body>
    </html>






    UPDATE
    <html>
    <body>
    <%
    set con=Server.CreateObject("ADODB.Connection")
    con.provider="Microsoft.JET.OLEDB.4.0"
    con.open "C:\inetpub\wwwroot\DB\college.mdb"

    sname= Request.Form("txtname")
    snewname= Request.Form("txtnewname")

    sql="UPDATE stud SET name='" & snewname & "' WHERE name='" & sname & "'"

    con.Execute sql
    set rs=server.CreateObject("ADODB.Recordset")
    rs.open sql, con
    If rs.state = 0 Then
    Response.write("record updated")
    End If

    set rs=nothing
    con.close
    set con=nothing
    %>
    </body>
    </html>



                                                                      DELETE
    <html>
    <body>
    <%
    set con=Server.CreateObject("ADODB.Connection")
    con.provider="Microsoft.JET.OLEDB.4.0"
    con.open "D:/college.mdb"

    sname= Request.Form("txtname")
    sql="DELETE FROM stud  WHERE name='" & sname & "'"


    con.Execute sql
    set rs=server.CreateObject("ADODB.Recordset")
    rs.open sql, con

    If rs.state = 0 Then
    Response.write("record deleted")
    End If

    set rs=nothing
    con.close
    set con=nothing
    %>
    </body>
    </html>



    DISPLAY OR DATA REPORT
    <html>
    <body>
    <%
    set con=Server.CreateObject("ADODB.Connection")
    con.provider="Microsoft.JET.OLEDB.4.0"
    con.open "C:\inetpub\wwwroot\DB\college.mdb"

    set rs = Server.CreateObject("ADODB.recordset")
    rs.Open "SELECT name, college FROM stud", con
    %>

    <table border="1">
     <tr>
      <%for each x in rs.Fields
        response.write("<th>" & x.name & "</th>")
      next%>
      </tr>

    <%do until rs.EOF%>
      <tr>
      <%for each x in rs.Fields%>
        <td><%Response.Write(x.value)%></td>
      <%next
      rs.MoveNext%>
      </tr>
    <%loop
    rs.close
    con.close
    %>
    </table>
    </body>
    </html>





    Enjoy the WEB world
     



                 
              
                    -Created By Ashutosh And Sagar And Gautam
                                                                        (Indiraites)

    For any grievance mail us on