944,147 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 5101
  • ASP RSS
May 25th, 2007
0

how to retrive data from different Ms Access tables using ASP

Expand Post »
hi
i have a problem if any one can help me please. i have 2 tables in Access database- Drug_Name and Chemistry. i have to retrive the from DB to the ASP. the Drug_Name has Drug_ID, D_name, Synonyms as the fields. once the user write a name it should check to the Drug_Name with the Synonyms fields and then with help of Drug_ID it should retrive D_name from Drug_Name table and other fields from Chemistry table.....
the code i used is :-
ASP Syntax (Toggle Plain Text)
  1. <HTML>
  2. <BODY>
  3. <%
  4. Actionvar=Request.QueryString("actionvar")
  5. strURL = Request.ServerVariables("URL")
  6. strSearch = Request.form("search")
  7. %>
  8. <p>Search our sample db by first or last name. (% returns all)</p>
  9. <form action="<%= strURL %>" method="post">
  10. <input type = "text" name="search" size = "30" value="<%= strSearch %>" />
  11. <input type="submit" />
  12. </form>
  13. <%
  14. If strSearch <> "" Then
  15. Set conn = server.createobject("adodb.connection")
  16. DSNtemp = "DRIVER={Microsoft Access Driver (*.mdb)}; "
  17. DSNtemp=dsntemp & "DBQ=" & server.mappath("Databases/nprcDrugsDB.mdb")
  18. conn.Open DSNtemp
  19.  
  20. strSQL= "SELECT * FROM Drug_Name, Chemistry WHERE Drug_Name.Drug_ID = Chemistry.Drug_ID And
  21. Drug_Namerequest.form("search")Search, "'", "''") & "'"
  22. response.write sql & "<br>" & vbNewLine
  23.  
  24. set rstSearch = conn.execute(strSQL)
  25. %>
  26. <table border="1">
  27. <tr>
  28. <th>Name</th>
  29. <th>Salts</th>
  30. </tr>
  31. <%
  32. Do While Not rstSearch.EOF
  33. %>
  34. <tr>
  35. <td><%= rstSearch.Fields("D_Name").Value %></td>
  36. <td><%= rstSearch.Fields("S").Value %></td>
  37. </tr>
  38. <%
  39. rstSearch.MoveNext
  40. Loop
  41.  
  42. %>
  43. </table>
  44. <%
  45.  
  46. rstSearch.Close
  47. conn.Close
  48. Set conn = nothing
  49.  
  50. End If
  51. %>
  52. </BODY>
  53. </HTML>

here only the html codes works but ASP codes dont work
i believe that SQL query is correct must be retrival ASP code is not correct
plz help
thanks
neha
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nehashri is offline Offline
21 posts
since Jan 2007
May 30th, 2007
0

Re: how to retrive data from different Ms Access tables using ASP

Can you show us the result of the response.write sql statement
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Sitestepper is offline Offline
6 posts
since May 2007
Jun 7th, 2007
0

Re: how to retrive data from different Ms Access tables using ASP

HEy this code is now working asp codes had some problem thanks for reply
neha
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nehashri is offline Offline
21 posts
since Jan 2007
Jun 9th, 2007
0

Re: how to retrive data from different Ms Access tables using ASP

Hi neha,
Can you show the right code?

retrieving data from two databases... i'm also in a way to display like that.... can you help me out in this regards.??
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
Hellodear is offline Offline
53 posts
since Feb 2007
Jun 9th, 2007
0

Re: how to retrive data from different Ms Access tables using ASP

hi,
your code is right but the query is not giving any result check your query in access.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MohitB is offline Offline
6 posts
since May 2007
Feb 5th, 2010
0
Re: how to retrive data from different Ms Access tables using ASP
hi,

I am shital I want to write login in html page. please help me out
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shital050384 is offline Offline
1 posts
since Feb 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: email sending form....help
Next Thread in ASP Forum Timeline: advice on timesheetmanager





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC