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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript Reading Database

Status
Not open for further replies.

Cassien

Programmer
Sep 17, 2002
94
0
0
Since this is a rather basic question I've had a quick check through the forum, but can't find any other posts about it so here goes...

I'm looking to read in some data from a database to populate a list box using Javascript, (a) is this possible and (b) does anyone know a link to some decent info on it.

Basically the db is MS-SQL server and I want to step through a set of columns until it reaches a keyword (an empty column effectivly) and populate a list box with the data.

Here's a link to the present model
I'm hoping to fill the right hand list with data that is drawn from the db it updates (see the query box)

Thanks to anyone who can help...
 
btw sorry if you follow the URL and get a error message, I'm changing things around constantly, so you're quite likely to get a javascript error or two!
 
Hi
It isn't possible using javascript, you'll have to go server-side. ASP or PHP

For the exact SQL syntax to return the correct records, try the SQL Server Programming forum: (forum183)

but basically it will be something like this (ASP):

<%
SQL=&quot;SELECT * FROM yourtable&quot;
set rs=conn.execute(SQL)
%>

<form>
<select>
<%
do while not rs.eof
%>
<option value=&quot;<%=rs(&quot;fieldname&quot;)%>&quot;><%=rs(&quot;fieldname&quot;)%></option>
<%rs.movenext
loop
%>
</select>
</form>

Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Hi
It isn't possible using javascript, you'll have to go server-side. ASP or PHP

For the exact SQL syntax to return the correct records, try the SQL Server Programming forum: (forum183)

but basically it will be something like this (ASP):

<%
SQL=&quot;SELECT * FROM yourtable&quot;
set rs=conn.execute(SQL)
%>

<form>
<select>
<%
do while not rs.eof
%>
<option value=&quot;<%=rs(&quot;fieldname&quot;)%>&quot;><%=rs(&quot;fieldname&quot;)%></option>
<%rs.movenext
loop
%>
</select>
</form>

Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Still not sure about how to compare it against the table on the left... to remove duplicates...
 
That's where the SQL forum would probably help you. I'm sure there's a query that would do that for you.

Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top