473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Dynamic Table

HI ALL
I want create Dynamic table from database. Its have 100 box but 10 Rows 10 x 10 Iam using dream weaver CS3. I cant do it in asp .
any one help me. thanks in advance

my code is follow
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <!--#include file="Connections/myconn.asp" -->
  3. <!--#include file="includes/header.asp" -->
  4.  
  5. <%
  6. Dim rs
  7. Dim rs_cmd
  8. Dim rs_numRows
  9. Dim Repeat1__numRows
  10. Dim Repeat1__index
  11. Dim Repeat2__numRows
  12. Dim Repeat2__index
  13.  
  14. Set rs_cmd = Server.CreateObject ("ADODB.Command")
  15. rs_cmd.ActiveConnection = MM_myconn_STRING
  16. rs_cmd.CommandText = "SELECT plotid, available FROM vnph2 ORDER BY sno" 
  17. rs_cmd.Prepared = true
  18.  
  19. Set rs = rs_cmd.Execute
  20. rs_numRows = 0 
  21. Repeat2__numRows=0
  22. %>
  23.  
  24. <%
  25.  
  26. Response.Write("<table border='1' cellpadding='2' cellspacing='2'>")
  27.  
  28.      While ((Repeat2__numRows <> 0) AND (NOT rs.EOF)) 
  29.                         Response.Write("<tr>")
  30.  
  31.  
  32. if (rs.Fields.Item("available").Value)="0" then
  33.  
  34.      response.write("<tr><td colspan=9 align=center bgcolor=00FF00 width='100' height='100'><font size=2>"& "plot"  & (rs.Fields.Item("plotid").Value) & "<br><br><a href= payment.asp?" & (rs.Fields.Item("plotid").Value) & ">"& (rs.Fields.Item("plotid").Value) &"</a></font></td>")
  35.   else
  36.      response.write("<tr><td colspan=9 align=center bgcolor=FFCCFF width='100%'><font size=2>"& "plot"  & (rs.Fields.Item("plotid").Value) & "<br><br><a href= payment.asp?" & (rs.Fields.Item("plotid").Value) & ">"& (rs.Fields.Item("plotid").Value) &"</a></font></td>")
  37. end if
  38.  
  39.  
  40.  
  41.   Repeat2__index=Repeat2__index+1
  42.   Repeat2__numRows=Repeat2__numRows-1
  43.   rs.MoveNext()
  44. Wend
  45.  
  46. Response.Write("</tr>")
  47. Response.Write("</table>") %>
  48. </BODY></html>
  49. <%
  50. rs.Close()
  51. Set rs = Nothing
  52. %>
Jan 15 '08 #1
6 2064
jhardman
3,406 Expert 2GB
It looks like your code is good. What problem is it giving you?

Jared
Jan 16 '08 #2



I want code for above sample from database

thanks for your reply
Jan 17 '08 #3
Dear friends
I want create Dynamic table from database. Its have 100 box but 10 Rows 10 x 10 Iam using dream weaver CS3. I cant do it in asp .
any one help me. Sample output
[IMG]

[/IMG]


my code is follow
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <!--#include file="Connections/myconn.asp" -->
  3. <!--#include file="includes/header.asp" -->
  4.  
  5. <%
  6. Dim rs
  7. Dim rs_cmd
  8. Dim rs_numRows
  9. Dim Repeat1__numRows
  10. Dim Repeat1__index
  11. Dim Repeat2__numRows
  12. Dim Repeat2__index
  13.  
  14. Set rs_cmd = Server.CreateObject ("ADODB.Command")
  15. rs_cmd.ActiveConnection = MM_myconn_STRING
  16. rs_cmd.CommandText = "SELECT plotid, available FROM vnph2 ORDER BY sno" 
  17. rs_cmd.Prepared = true
  18.  
  19. Set rs = rs_cmd.Execute
  20. rs_numRows = 0 
  21. Repeat2__numRows=0
  22. %>
  23.  
  24. <%
  25.  
  26. Response.Write("<table border='1' cellpadding='2' cellspacing='2'>")
  27.  
  28.      While ((Repeat2__numRows <> 0) AND (NOT rs.EOF)) 
  29.                         Response.Write("<tr>")
  30.  
  31.  
  32. if (rs.Fields.Item("available").Value)="0" then
  33.  
  34.      response.write("<tr><td colspan=9 align=center bgcolor=00FF00 width='100' height='100'><font size=2>"& "plot"  & (rs.Fields.Item("plotid").Value) & "<br><br><a href= payment.asp?" & (rs.Fields.Item("plotid").Value) & ">"& (rs.Fields.Item("plotid").Value) &"</a></font></td>")
  35.   else
  36.      response.write("<tr><td colspan=9 align=center bgcolor=FFCCFF width='100%'><font size=2>"& "plot"  & (rs.Fields.Item("plotid").Value) & "<br><br><a href= payment.asp?" & (rs.Fields.Item("plotid").Value) & ">"& (rs.Fields.Item("plotid").Value) &"</a></font></td>")
  37. end if
  38.  
  39.  
  40.  
  41.   Repeat2__index=Repeat2__index+1
  42.   Repeat2__numRows=Repeat2__numRows-1
  43.   rs.MoveNext()
  44. Wend
  45.  
  46. Response.Write("</tr>")
  47. Response.Write("</table>") %>
  48. </BODY></html>
  49. <%
  50. rs.Close()
  51. Set rs = Nothing
  52. %>
Jan 20 '08 #4
jhardman
3,406 Expert 2GB
Please don't double-post your questions. If you would like, send a pm to a forum expert asking for attention to your question.

I have read your question, but I'm not sure what you want. Your question is too vague.

Jared
Jan 21 '08 #5
how to break after 20th box I mean second row
Jan 23 '08 #6
how to break after 20th box I mean second row
I cannot insert repeat region.
nested repeat regions are supported that is a error msg
Jan 23 '08 #7

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

Similar topics

4
by: Tim.D | last post by:
People, I've ventured into the wonderful world of Stored Procedures. My first experience has been relatively successful however I am stuck on using host variables to specifiy actualy table or...
14
by: Ina Schmitz | last post by:
Hello, I would like to get the logical and physical reads for every sql statement executed. Thatfore, I used the command "db2 get snapshot for dynamic sql on <mydatabase>". There, I could see...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
3
by: CAD Fiend | last post by:
Hello, Well, after an initial review of my database by my client, they have completely changed their minds about how they want their form. As a result, I'm having to re-think the whole process....
1
by: Henke | last post by:
Hello, I have one ImageButton controls which I initialize in Page_Load and declare on class level. ImageButton save = new ImageButton(); save.ImageUrl = "save.gif" save.Click += new...
7
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to....
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
6
by: =?ISO-8859-1?Q?Tim_B=FCthe?= | last post by:
Hi, we are building a Java webapplication using JSF, running on websphere, querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and PreparedStatements only (aka dynamic SQL). Every night,...
12
by: ive1122 | last post by:
Hi guys, I am looking into create a dynamic survey as posted in Get User Input From Dynamic Controls but with some different environment Below is what i am trying to do: First when the user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.