I need your help. I have created a table in the asp form attached to this thread called task list. Basically, for each project, there will be multiple people assigned to a specific task(project Id number should stay the same). I need code that would:
1. Save multiple rows, i.e. for loop or while loop
2. Stop saving rows if there is no information in it
Each row will be a separate set of record but linked by the Project Id number. Can arrays do this? If so, how?
Any ideas/suggestions? Thanks in advance
-vbuser1976
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
are you getting the data from a database? or where? or what? or... just be more specific...
i don't quite understand what u want to do but... it might be something like this.
Code:
dim field1
dim field2
Response.Write("<table>")
Do
Response.Write("<tr><td>" & field1 & "</td><td>" & field2 & "</tr>")
'I called it GetNextField because i don't know how you are getting your data, wether it is an array etc.
field1 = GetNextField()
Loop While Trim(field1) <> 0
Response.Write ("</table>")
this is just a concept and i am not really sure what you are talking about.
ok, i now understand what you are doing. what i would withing the row of the project ID, have a string that stores all the names, seperated by commas. and then when you need to call that list out of the database you can go ahead and split it up.
i think thats what you meant. you might also consider doing this... having another table in your database where you store user information. when you click on the project ID the asp script calls up the user database and prints out a list of who has the projectID in their current projects.
so it would be like...
Code:
if instr(activeprojects,projectID) > 1 then response.write(username)
First of all I would like to say welcome to the forums.
Now, regarding your posts, if the project is new, then it is not getting any information from the database. I already created the second table for the database that would have all of the information needed.
Let me explain in a little more detail what I am trying to do. I have a asp form page that is using html code to create the table(since the html table is static). If you look at the attachment that is part of the first post, you will see the table. Now I need to know that if I use a for loop to populate the table, if there is anything in the database, how do I go about it? Does each field in a column need to have the same name? Also I want it to leave rows empty if there is not data available. Would rs.movenext work in this? I hope this helps you to better understand what I am trying to do.
Thanks again in advance for your help.
-vbuser1976
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
Okay, forgive me if I'm getting you wrong, but from how I read it, you want something like this:
First, you get the data from the database and put in a recordset we will call RS_Data, using something like '"select TaskDescription, Priority, AssignedTo, DueDate, Status, Comments from TABLE where ProjectID = " & numProjectID', where numProjectID is the ID of the project you wanna get the data for.
If you wanna check if the fields are empty first, before displaying their value, you could go something like:
=========================================
....
<%
do while not RS_Data.EOF
response.write("<tr>")
if not IsNull(RS_Data("TaskDescription")) then
response.write("<td>" & RS_Data("TaskDescription")) & "</td>")
else
response.write("<td></td>")
end if
if not IsNull(RS_Data("Priority")) then
response.write("<td>" & RS_Data("Priority")) & "</td>")
else
response.write("<td></td>")
end if
Thanks for your reply. My question is this: If the table was already created using the html code (because it needs to be static), do I still have to use the<td> and <tr>? If not, how do I make sure that the data is going to the right column/row?
I hope this isn't confusing.
-vbuser1976
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
If the <table> and </table> tags are already there, you can just leave those out of the code I wrote. If there are already other rows of data in that table, you might want to use something like what I wrote below.
If not, then don't even bother.
=========================
<tr>
<td colspan="x"> (x being the number of td's used per row before)
<table>
(code from before, withouth the <table> and </table> tags)
It looks like the populating of the table is working. But, How do I save the changes or additions to the table? I know about rs.update but I need to know how I save this stuff. Thanks for all you help. I hope this isn't confusing.
-vbuser1976
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
Okay, so you sorta wanna use it like a grid in VB?
Well, what you could do is put the table on a form, and then when you leave the page (and wanna save the data), is read out the data in the different input fields, and then update the table for every row. To do this, you would also need to keep track of the ID for each row of data (for instance by putting it in a hidden input field).
But I bet there are easier ways to do this, but I don't know of any, so someone else please help!?
finally, someone understood what I am trying to do. Yeah, I do want it to work like a grid in VB. But I do need some sample code to understand what you are trying to say, MarcelB. I have an idea of what you are trying to say, but I am not sure.
Thanks again for your enormous help. And, if you know of anyone that might have an idea as well, you can forward this thread.
-vbuser1976
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
Okay, well, let's wait if someone else knows an easier way and posts that. If not, I'll send you some sample code tomorrow, okay? Maybe it's easier (and less poluting to the forum) to do that through e-mail then.
and i have a the table tags around that... its such a mess because there are soo many options, i wish i had a simpler version for you (believe it or not, i cut out a couple if statements)
Correct me if I'm wrong, but I think that part was clear to him by now. I think it's the updating of the fields from the page back into the database that he'd like an example of, right?