|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Retrieiving Info from Database
I am trying to learn how to retrieve information from the database. I am not too familiar with ASP but I was told to use it. How do I go about doing this? What specific aspect of ASP do I need to learn? And if anyone has any code that can help me, please share. Any help would be greatly appreciated. Thanks.
|
|
#2
|
|||
|
|||
|
---BEGIN QUOTE---
I am trying to learn how to retrieve information from the database ---END QUOTE--- Humm.... ---BEGIN QUOTE--- I am not too familiar with ASP but I was told to use it. ---END QUOTE--- Ok this is where things get confusing and **YOU** need to be more specific! I don't care WHO told you to use ASP, my question to you is : "what's the application/stuff your working on?" Is it web oriented? I can only assume since you've posted in the ASP forum but again, that can be anything... What is it your doing??? What language are you using??? Which environment are you in??? Which OS are you using??? Which database are you using??? Which version of IIS are you using, if its an web application??? What??? Don't get me wrong, I want to help you but in order to do so, you'll need to help yourself first! If you've been told to use ASP then I guess your using ASP pages right? is that correct? Are you using HTML pages? Or are you using/cerating a VB application(Desktop)??? Is it an INTERNET application? Or Is it an DESKTOP application? What? Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
Whoa, Thats a lot of questions. But here I go.
I am working on an internet application of which the first page is an HTML page. There are hidden values passed from the HTML page to an asp page. I need to use the hidden values that were passed to run a query. Here is my problem. I have 2 drop down menues on my HTML page, from which ONE item must be selected. So there should be 2 values passed on, one from each menu. I need to use a combination of those two values to run the query. I have no idea how to do this. I hope that is better. If you could guide me as to what to focus on, or some sample code, that would be great. Thanks! |
|
#4
|
|||
|
|||
|
Ok so this is what you basically have:
-----------------HTML PAGE------------------------ <html> <body> <form name="frmMain" action="test.asp" method="POST"> <Hidden Field 1> <Hidden Field 2> <Combobox 1> <Combobox 2> <Submit Button> </form> </body> </html> -----------------HTML PAGE------------------------ Now, notice the action attribute, it is equal to test.asp that means that when the user clicks on your <Submit Button> *ALL* the information held between the tag <form> and </form> will be sent to the page test.asp Also note the method attribute that is equal to *POST* that is important because that tells us(the programmer) HOW the data is SENT from your <form>...</form>. Now let's code the test.asp page... -----------------------ASP PAGE-------------------------- <%@ Language=VBScript %> <% Dim strValue_Of_HiddenField1 Dim strValue_Of_HiddenField2 Dim strValue_Of_Combobox_1 Dim strValue_Of_Combobox_2 strValue_Of_HiddenField1 = Trim(Request.Form("hid1")) strValue_Of_HiddenField2 = Trim(Request.Form("hid2")) 'NOTE: I've assumed that the names of the 2 hidden fields 'were hid1 and hid2 'Also note that I've used the .Form to retrieve the data 'NOT .QueryString Why????? 'Because the method attribute of your <form>...</form> 'was set to equal POST remember??? 'Ok now let's retrieve the data for the two combobox's strValue_Of_Combobox_1 = Trim(Request.Form("cbo1")) strValue_Of_Combobox_2 = Trim(Request.Form("cbo2")) 'NOTE: I've assumed that the names of the 2 combobox fields 'were cbo1 and cbo2 'So...now you have/hold into VARIABLES the data chosen/selected by your users... 'What next???.... 'You say you need to make a combination of the 2 values right? 'What do you mean by combination? 'Do you mean you need to execute TWO different Queries? 'OR 'Do you mean you need to concatenate the TWO values AND then execute an SQL Query? %> Hope this helps! Sincerely Vlince |
|
#5
|
|||
|
|||
|
This is my code for the first page:
<body> <hr align="center"> <h2 align="center"> <font face="Arial" color="#000099"> Production Statistics Reporting Application</font> </h2> <hr align="center"> <form id ="form1" method="POST" action="results1.asp"> <p><font color="#000099">Select an Application: <p><select size="1" name="Application"> <option></option> <option>Airtrac</option> <option>Banker Evaluation</option> <option>Best Books</option> <option>CDG - GB2000</option> <option>Central Services</option> <option>Citivision</option> <option>Clients</option> <option>Compass</option> <option>Deal Management System</option> <option>ECM - Equity Capital Management</option> <option>GB - Market Data</option> <option>GB Framework</option> <option>HATS</option> <option>Headcount System</option> <option>IB Information Exchange</option> <option>IB Subledger</option> <option>Information Services</option> <option>Legal Counsel Law Firms</option> <option>M&A Week in Review</option> <option>MarketShare</option> <option>New Business Memorandum</option> <option>Photolibrary</option> <option>Pitch Book</option> <option>Radar</option> <option>SDA/Syndicates</option> <option>Total Performance Management</option> </select></p> <p>Select a Variable:</p> <p><select size="1" name="Variable"> <option></option> <option>Amount of Dollars</option> <option>Amount of Hours</option> <option>Number of Tickets</option> </select></p> <input type="button" onclick= "ValidateForm()" name="my_submit" value="Submit"> </form> <SCRIPT language="javascript"> function ValidateForm() { if(document.all("Application").selectedIndex == 0) { alert('You have not entered an Application. Please enter it now.') //form.application.(); return false; } if(document.all("Variable").selectedIndex == 0) { alert('You have not entered an Variable. Please enter it now.') //form.variable.(); return false; } form1.submit(); return true; } </SCRIPT> </font> </body> The second Page I have this: <body> <hr align="center"> <p align="center"><font color="#000099"><b>Results Page</b></font></p> <hr align="center"> <p><font color="#990033">The values selected are:</font></p> <% Dim sOutput sOutput = Request.Form("application") & "<br>" & Request.Form("variable") Response.Write(sOutput) %> <p><a href="prod_stats_app.htm"><font color="#990033">Go back</font></a></p> </body> I Want to run a query based on the combination of the two hidden values. Also, I dont quite understand what you mean by Combobox - I dont really have that. Do I need that? You really are helping a lot! I want to thank you so much! All your help is greatly appreciated! |
|
#6
|
|||
|
|||
|
---BEGIN QUOTE---
Also, I dont quite understand what you mean by Combobox - I dont really have that. Do I need that? ---END QUOTE--- Didn't YOU say you had: ---BEGIN QUOTE--- I have 2 drop down menues on my HTML page ---END QUOTE--- Now to ME a drop down menu means a combobox/dropdownbox no??? You see, how **IMPORTANT** terminology IS...this avoids confusing and long post reponses...for nothing ![]() Now, to me a COMBINATION of two things MEANS: The two of them together...like GIN AND TONIC that is a combination of the TWO So a combination of two variables IS the two of them together So, my question to you is: What is YOUR definition of combination??? Is it: <% Dim strTotal Dim strVar1 Dim strVar2 strTotal = strVar1 & strVar2 'FOR DEBUG ONLY 'Response.Write strTotal 'Response.End %> Then you want to query with the variable **strTotal** OR is it: <% Dim strVar1 Dim strVar2 'Build Query 1 with variable ***strVar1*** 'Build Query 2 with variable ***strVar2*** %> Hope this helps! Sincerely Vlince |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Retrieiving Info from Database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|