Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beginners Trouble with Frontpage / SQL syntax ??

Status
Not open for further replies.

geocabs

IS-IT--Management
Jul 6, 2000
24
GB
I need to query a database (SQL Server). I need to look up a table which contains a list of countries (It needs to be a drop down list box). I then need another drop down list box, either on the same page or perhaps another page which will contain a town name. I then need the results of these selections to go directly to a database results region on another page.<br><br>Im using Frontpage 2000. Can anyone tell me explicitly how to do this. I seem to be able to get all the elements to work individually but I cant link them!!!! AAaaarggghh !!<br><br>I can get a drop down list of countries to work with a database results region on trhe same page but I cant get another drop down embedded in from another table. Can frontpage handle opening more than one table at a time ? Maybe this is the problem.<br>
 
Dear geocabs,<br><br>First FrontPage is just your editor. It has nothing to do with connecting to your database at runtime.<br><br>Yes you should be able to do what you are describing up to the point where you say this:<br>&gt; I then need the results of these selections to go directly to a database results region on another page.<br><br>I have no idea what that means.<br><br>However, you can build two separate dropdown lists from two different tables in your database on the same .ASP page. You can either perform two different queries or if your database supports UNION querys you could handle it that way. If you are getting errors reported in the browser post the error message along with the ASP code related to the problem.<br><br>Good luck<br>-pete<br>
 
I found that Front Page will do certain things just fine by itslef but when you want to combine items you have to create the page from scratch.<br>Since you are on the .ASP forum, I suspect you want to make your own .asp page.<br>Then yes you can open a lots of Tables in SQL server.<br><br>This will open a connection to s SQL Server database then using an SQL statement return something.<br>------------------------------------------------------<br>&lt;%<br>Set Conn = server.CreateObject(&quot;ADODB.Connection&quot;)<br>Conn.Open &quot;driver=SQL Server;server=YOURSERVER;uid=USERID;pwd=PASSWORD;database=YOURDATABASE;&quot;<br>Set RS1 = Conn.Execute(&quot;SELECT * From yourtable Where [somecolumn] ='&quot; & somevalue & &quot;'&quot;)<br>%&gt;<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Hi<br><br>The following code generated by Frontpage works. It gives me a drop down list of countries from my SQL Country table.<br><br>&lt;html&gt;<br><br>&lt;head&gt;<br>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&gt;<br>&lt;meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;&gt;<br>&lt;meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;&gt;<br>&lt;title&gt;New Page 1&lt;/title&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br><br>&lt;p&gt;&lt;nobr&gt;&lt;!--webbot bot=&quot;DatabaseRegionStart&quot; startspan<br>s-columnnames=&quot;Country,Continental_Region,Administrative_Capital,Financial_Capital,International_Direct_Dialing_Country_Code,Major_Currency,Minor_Currency,Constitutional_Status,State_Airline,State_Railway,Flag,Geocabs_Web_Page_Gennifo,upsize_ts&quot;<br>s-columntypes=&quot;202,202,202,202,202,202,202,202,202,202,205,203,128&quot;<br>s-dataconnection=&quot;GeocabsSQL&quot; b-tableformat=&quot;FALSE&quot; b-menuformat=&quot;TRUE&quot;<br>s-menuchoice=&quot;Country&quot; s-menuvalue=&quot;Country&quot; b-tableborder=&quot;TRUE&quot;<br>b-tableexpand=&quot;TRUE&quot; b-tableheader=&quot;TRUE&quot; b-listlabels=&quot;TRUE&quot;<br>b-listseparator=&quot;TRUE&quot; i-ListFormat=&quot;0&quot; b-makeform=&quot;TRUE&quot;<br>s-recordsource=&quot;Country_Data&quot; s-displaycolumns=&quot;Country&quot; s-criteria s-order<br>s-sql=&quot;SELECT * FROM Country_Data&quot; b-procedure=&quot;FALSE&quot; clientside<br>SuggestedExt=&quot;asp&quot; s-DefaultFields s-NoRecordsFound=&quot;No records returned.&quot;<br>i-MaxRecords=&quot;256&quot; i-GroupSize=&quot;0&quot; BOTID=&quot;0&quot; u-dblib=&quot;_fpclass/fpdblib.inc&quot;<br>u-dbrgn1=&quot;_fpclass/fpdbrgn1.inc&quot; u-dbrgn2=&quot;_fpclass/fpdbrgn2.inc&quot;<br>local_preview=&quot; &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Database&lt;/span&gt; &quot;<br>preview=&quot; &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Database&lt;/span&gt; &quot; --&gt;&lt;!--#include file=&quot;_fpclass/fpdblib.inc&quot;--&gt;<br>&lt;%<br>fp_sQry=&quot;SELECT * FROM Country_Data&quot;<br>fp_sDefault=&quot;&quot;<br>fp_sNoRecords=&quot;No records returned.&quot;<br>fp_sDataConn=&quot;GeocabsSQL&quot;<br>fp_iMaxRecords=256<br>fp_iCommandType=1<br>fp_iPageSize=0<br>fp_fTableFormat=False<br>fp_fMenuFormat=True<br>fp_sMenuChoice=&quot;Country&quot;<br>fp_sMenuValue=&quot;Country&quot;<br>fp_iDisplayCols=1<br>fp_fCustomQuery=False<br>BOTID=0<br>fp_iRegion=BOTID<br>%&gt;<br>&lt;!--webbot bot=&quot;DatabaseRegionStart&quot; I-CheckSum=&quot;51573&quot; endspan --&gt;<br>&lt;select NAME=&quot;Country&quot; SIZE=&quot;1&quot;&gt;<br>&nbsp;&nbsp;&lt;!--webbot bot=&quot;AspInclude&quot; startspan CLIENTSIDE<br>&nbsp;&nbsp;U-INCFILE=&quot;_fpclass/fpdbrgn1.inc&quot; --&gt;&lt;!--#include file=&quot;_fpclass/fpdbrgn1.inc&quot;--&gt;&lt;!--webbot<br>&nbsp;&nbsp;bot=&quot;AspInclude&quot; I-CheckSum=&quot;62210&quot; endspan --&gt;<br>&nbsp;&nbsp;&lt;option&gt;&lt;%=FP_FieldHTML(fp_rs,&quot;Country&quot;)%&gt;&lt;/option&gt;<br>&nbsp;&nbsp;&lt;!--webbot bot=&quot;AspInclude&quot; startspan CLIENTSIDE<br>&nbsp;&nbsp;U-INCFILE=&quot;_fpclass/fpdbrgn2.inc&quot; --&gt;&lt;!--#include file=&quot;_fpclass/fpdbrgn2.inc&quot;--&gt;&lt;!--webbot<br>&nbsp;&nbsp;bot=&quot;AspInclude&quot; I-CheckSum=&quot;62218&quot; endspan --&gt;<br>&lt;/select&gt;&lt;!--webbot bot=&quot;DatabaseRegionEnd&quot; startspan b-tableformat=&quot;FALSE&quot;<br>b-menuformat=&quot;TRUE&quot; u-dbrgn2=&quot;_fpclass/fpdbrgn2.inc&quot; i-groupsize=&quot;0&quot; clientside<br>local_preview=&quot; &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Results&lt;/span&gt; &quot;<br>preview=&quot; &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Results&lt;/span&gt; &quot; --&gt;&lt;!--webbot<br>bot=&quot;DatabaseRegionEnd&quot; endspan --&gt;<br>&lt;/nobr&gt;&lt;/p&gt;<br><br>&lt;/body&gt;<br><br>&lt;/html&gt;<br><br><br><br>However I tried DougP's suggestion and I get an error - I think I may have an SQL configuration problem too.<br><br>Doug's code altered to suit my setup I think is as follows:-<br><br>&lt;html&gt;<br><br>&lt;head&gt;<br>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&gt;<br>&lt;meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;&gt;<br>&lt;meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;&gt;<br>&lt;title&gt;New Page 2&lt;/title&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br><br>&lt;%<br>Set Conn = server.CreateObject(&quot;ADODB.Connection&quot;)<br>Conn.Open &quot;driver=SQL Server;server=Mercury;uid=dbo;pwd=superman;database=geocabssql;&quot;<br>Set RS1 = Conn.Execute(&quot;SELECT * From Country_Data Where [Country] ='&quot; & somevalue & &quot;'&quot;)<br>%&gt;<br><br>&lt;/body&gt;<br><br>&lt;/html&gt;<br><br><br><br>The error I get in the browser is:-<br><br><br>Microsoft OLE DB Provider for ODBC Drivers error '80040e4d' <br><br>[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'dbo'. <br><br>/geocabs/test5.asp, line 14 <br><br><br><br>So now I have two problems !!! I dont know how to write the code and I got a failed login !!<br><br>To repeat or clarify my original problem I want to select a country from the country table and then on the same page select or type in a town and then a database search is done on these two fields. I can now get Frontpage 2000 to give me to input boxes where I have to type both the country and the town but I would like to select the country by querying the table instead - Anyone know the answer (maybe how to modify the form field) to this and the connectivity problem. Technet suggests a permissions problem but I can seem to resolve it<br><br>Aaaarrrrggggghhhhh !!! Computers !!<br>
 
Now I got the SQL Login problem solved but the code from dougP just gives me a blank page. Im pretty sure Im supposed to do something else with it but not really sure what - I guess Im looking for a few pointers in how to write / build a query<br><br>Help still required tho I can see some books being purchased soon !
 
Dear geocabs,<br><br>&gt; but the code from dougP just gives me a blank page<br><br>Yes the code only shows how to obtain a recordset using a SQL query. After that you must output the page using the resultant rows and columns from the recordset object.<br><br>There are plenty of code samples for interfacing with a database in ASP. msdn.microsoft.com is a great source there should also be sample ASP files installed under IIS on the server.<br><br>&lt;grumble&gt;<br>Many tools exist today that market themselves to be a miracle development tool. You don't need to know anything just point and click and presto you have a working application. In theory fine, in practice NOT! When the user doesn't understand the underlying technology it's just a matter of time before he/she is lost and cannot provide the solution required.&lt;/grumble&gt;<br><br>&quot;But, that's just my opinion... I could be wrong&quot;.<br>-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top