web 2.0

How to use ASP & Oracle Add/Insert Rows Data

How to use ASP & Oracle Add/Insert Rows Data This is tutorial asp developers how to using ASP add insert data to Oracle table.

ShotDev Focus:
- ASP & Oracle add insert data.

Example

asp_oracle_insert1.asp

  1. <% Option Explicit %>  
  2. <html>  
  3. <head>  
  4. <title>ShotDev.Com Tutorial</title>  
  5. </head>  
  6. <body>  
  7. <form action="asp_oracle_insert2.asp" name="frmAdd" method="post">  
  8. <table width="600" border="1">  
  9. <tr>  
  10. <th width="91"> <div align="center">CustomerID </div></th>  
  11. <th width="160"> <div align="center">Name </div></th>  
  12. <th width="198"> <div align="center">Email </div></th>  
  13. <th width="97"> <div align="center">CountryCode </div></th>  
  14. <th width="70"> <div align="center">Budget </div></th>  
  15. <th width="70"> <div align="center">Used </div></th>  
  16. </tr>  
  17. <tr>  
  18. <td><div align="center"><input type="text" name="txtCustomerID" size="5"></div></td>  
  19. <td><input type="text" name="txtName" size="20"></td>  
  20. <td><input type="text" name="txtEmail" size="20"></td>  
  21. <td><div align="center"><input type="text" name="txtCountryCode" size="2"></div></td>  
  22. <td align="right"><input type="text" name="txtBudget" size="5"></td>  
  23. <td align="right"><input type="text" name="txtUsed" size="5"></td>  
  24. </tr>  
  25. </table>  
  26. <input type="submit" name="submit" value="submit">  
  27. </form>  
  28. </body>  
  29. </html>  

asp_oracle_insert2.asp

  1. <% Option Explicit %>  
  2. <html>  
  3. <head>  
  4. <title>ShotDev.Com Tutorial</title>  
  5. </head>  
  6. <body>  
  7. <%  
  8. Dim Conn,strSQL,objExec  
  9. Set Conn = Server.Createobject("ADODB.Connection")  
  10. Conn.Open "DRIVER=Oracle Driver (*.mdb);DBQ=" & Server.MapPath("db/mydatabase.mdb"),"" , ""  
  11. strSQL = ""  
  12. strSQL = strSQL &"INSERT INTO customer "  
  13. strSQL = strSQL &"(CustomerID,Name,Email,CountryCode,Budget,Used) "  
  14. strSQL = strSQL &"VALUES "  
  15. strSQL = strSQL &"('"&Request.Form("txtCustomerID")&"','"&Request.Form("txtName")&"', '"&Request.Form("txtEmail")&"' "  
  16. strSQL = strSQL &",'"&Request.Form("txtCountryCode")&"','"&Request.Form("txtBudget")&"', '"&Request.Form("txtUsed")&"') "  
  17. Set objExec = Conn.Execute(strSQL)  
  18. If Err.Number = 0 Then  
  19. Response.write("Save completed.")  
  20. Else  
  21. Response.write("Error Save ["&strSQL&"] ("&Err.Description&")")  
  22. End If  
  23. Conn.Close()  
  24. Set objExec = Nothing  
  25. Set Conn = Nothing  
  26. %>  
  27. </body>  
  28. </html>  

Create a asp file and save to path root-path/myasp/

Run
http://localhost/myasp/asp_oracle_insert1.asp

Screenshot

ASP & Oracle (Add/Insert Data)

ASP & Oracle (Add/Insert Data)
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.