472,133 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

Fetching data from User

Hi I want to know how data is fetched from web page & stored in sql data base. I have the design of webpage but cannot save data in sql table. please help!
Sep 19 '07 #1
1 1224
shweta123
692 Expert 512MB
Hi,

What platform are you using? Is it a .Net?

If it is Asp and Sql Server then you can try this code
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim Con 
  3. Dim Sql
  4.  
  5. Set con=Server.CreateObject("Adodb.Connection")
  6.  
  7. 'Here comes your connectionstring
  8.  
  9. Con.ConnectionString = "Provider=SQLOLEDB.1;............ "
  10.  
  11. 'Open the connection
  12. Con.open
  13.  
  14. ''''''Fetch the values from page e.g.
  15.  
  16. Dim myName
  17. Dim myNo
  18.  
  19. myName = Request.Form("Textbox1")
  20. myNo = Request.Form("Textbox2")
  21.  
  22.  
  23. ''''''''Insert data into db.
  24.  
  25. Sql = "Insert into tablename(No,Name) values(myNo,myName)"
  26.  
  27. Con.execute(Sql)
  28.  
  29. Con.close
  30.  
  31. %>
Sep 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Srinivasan R | last post: by
1 post views Thread by nasirmajor | last post: by
22 posts views Thread by Sandman | last post: by
4 posts views Thread by tokcy | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.