HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 3rd, 2004, 01:50 PM
unicorn unicorn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Northern Ireland
Posts: 63 unicorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 47 m 50 sec
Reputation Power: 5
Access 97 limit

I have a form with a table of 20 lines and 17 text inputs per line = 340 fields....access 97 can only store a max of 255 fields per table, so I have two tables for this forms' data....(called JS1 & JS2) now I was wondering if I could replace all these 340 fields with , say 20 fields to represent each line and use comma delimited data per field...this would (If it will work) reduce the need for the two tables to represent this form, but how do I format this representation, and still be able to reference a particular 'cell' of the 340 represented? All the fields are numbers except for one on each line with is text. I do not need to do any maths on the numbers just make sure they ARE numbers typed by the user and show them on the form when taken from the DB, and printed when again collected from the DB onto another asp form. I know I could use a more stable/powerful DB, like SQL, but will get project running then I can look at improvements like that......any thoughts on getting me started?....>>>

Reply With Quote
  #2  
Old November 4th, 2004, 02:22 AM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,263 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 35 m 51 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
You may have a very good reason for it, but the database design sounds bizarre

Do you need to store the data all in one table or is there data in there that would be better stored in separate, related tables, which can then be referenced to collate the required data.

Reply With Quote
  #3  
Old November 4th, 2004, 02:26 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 27,003 Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 17 h 17 m
Reputation Power: 1572
indeed... if you have 20 lines in the html table and 17 boxes in each, mirror that in the database: have one table with 17 fields (one field for each text box in the form) and with 20 records, one record for each line. makes much more sense, isn't it?

Reply With Quote
  #4  
Old November 4th, 2004, 02:54 AM
unicorn unicorn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Northern Ireland
Posts: 63 unicorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 47 m 50 sec
Reputation Power: 5
Access 97 limit

OK guys...Unfortuneately there are no fields that can be collated into separate tables ....these whole forms are full of unique data not used anywhere else in the project, so yes I can see about changing the DB Schema but as each form is unique cant try that......OK Shadow on the other idea will have a go at that and let u know...thanks guys.....cul....>>

Reply With Quote
  #5  
Old November 4th, 2004, 09:20 AM
unicorn unicorn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Northern Ireland
Posts: 63 unicorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 47 m 50 sec
Reputation Power: 5
Access 97 limit

Right, I’ve got the DB structure OK now, with 17 fields and up to the DB Max in lines. My fields are just labeled field1, field2 up to field17. The other fields are called EstNo, ShtNum and Line, which will always have entries, if they are in the table at all, but the field ones may or may not be empty..I have it reading the DB OK and filling out the form fine..Its when it comes to the user changing the data in the fields, on the form, and saving the fields to the DB that the prob is…My code so far for the save button is….

query = ("SELECT * FROM JS WHERE EstNo="&"'"&estno&"'" &" AND ShtNum="&i)
ShepRS.Open Query,ConnDB,adOpenStatic, adLockOptimistic
ShepRS.movefirst
x = 1
do while NOT ShepRS.EOF
y = 1
if ShepRS("Line") = x then ' if Line x exists in JS table
if isEmpty(tempStore(x,y)) then ' if JS sheet line x is empty
ShepRS.delete
ShepRS.update
else
for y = 1 to 17 ' write JS sheet line x to table.
ShepRS("field"&y) = tempStore(x,y)
next
ShepRS.update
end if
else ' Line x is not in JS table
if isempty(tempStore(x,y)) then ' sheet line is empty do nothing
else ' sheet line is not empty & Line not in JS Table
ShepRS.addNew ' add line data to table
ShepRS("EstNo") = estno
ShepRS("ShtNum") = i
ShepRS("Line") = x
for y = 1 to 17
ShepRS("field"&y) = tempStore(x,y)
next
ShepRS.update
end if
end if
x = x+1
ShepRS.movenext
loop

The english description of the code is….If the line exists in the table then check to see if the same line on the sheet is empty (all fields empty, if some have data then this is false) and if it is then delete the line from the table..else if the line does not exist in the table and the line is totally blank on the sheet then move on to the next line else if there is no line in the table but some of the fields have data then write the new line into the table.
The prob is the lines concerning …..isempty(tempStore(x,y)….this is only looking at he first field of the line, whereas I need it to look at all fields on the line and ONLY IF ALL are empty then do whichever……All the above code does is add another line to the DB with the Estno , ShtNum OK and the Line number of the next line which has the first field empty., then it finishes..that’s all it does to the whole table..…

Reply With Quote
  #6  
Old November 4th, 2004, 09:36 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 27,003 Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 17 h 17 m
Reputation Power: 1572
your code is bit messy, use the [ Code] and [ /Code] tags (remove the spaces) in the future to preserve the structure...
anyway, tempStore(x,y) is indeed only one value. what you mean by "I need it to look at all fields on the line"? what is line in this aspect? I see only two dimensional array, no line or fields...

Reply With Quote
  #7  
Old November 4th, 2004, 09:46 AM
unicorn unicorn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Northern Ireland
Posts: 63 unicorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 47 m 50 sec
Reputation Power: 5
Access 97 Limit

OK Shadow, yes the code looks a lot better on my screen , will remember Code & /Code in future......ok the fields on each line are represented by the y value (1 to 17) and the lines, on the form, are the value x (from 1 up to whatever number as there will be balnk lines on the form i thought there was no sense in storing their values, so the number of lines will vary from estno to estno up to a max of 20 per ShtNum ....help?

Reply With Quote
  #8  
Old November 4th, 2004, 09:55 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 27,003 Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 17 h 17 m
Reputation Power: 1572
hmm... so you have to check if tempStore(x,y) is empty for every 1<=y<=17 right? if so, have such code:
Code:
     if IsArrayEmpty(tempStore, x) then   ' if JS sheet line x is empty
  

and have this function written somewhere in the page:
Code:
  Function IsArrayEmpty(arr2D, x)
     Dim y
     For y=1 To UBound(arr2D, 2)
  	  If Len(arr2D(x, y))>0 Then
  		 IsArrayEmpty=False
  		 Exit Function
  	  End If
     Next
     IsArrayEmpty=True
  End Function
  

Reply With Quote
  #9  
Old November 5th, 2004, 08:45 AM
unicorn unicorn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Northern Ireland
Posts: 63 unicorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 47 m 50 sec
Reputation Power: 5
Access 97 limit

Fine Shadow, ur function helped a lot..it works fine....now
I’m nearly back on track…altering the DB schema has caused probs all over the place!…but sorting them out , with just one prob left before I get back on track………In the table JS there can be anything from 1 to 20 in the number of Lines per ShtNum. There will always be at least one Line associated with a particular ShtNum… so u can have the DB Table like so…..
Code:
EstNo		ShtNum		Line		field1		field2      etc

VIC1		1		1				?
VIC1		1		3		?			
VIC1		1		12		?
VIC1		2		1
VIC1		2		2		?
VIC1		3		1
VIC1		4		1				?
VIC1		4		2

Now the prob is ..When I delete all Lines associated with say ShtNum 2 , I need the ShtNums after that to be re-numbered to 2 & 3 in the above example DB..

Code:
EstNo		ShtNum		Line		field1		field2      etc

VIC1		1		1				?
VIC1		1		3		?			
VIC1		1		12		?
VIC1		2		1
VIC1		3		1				?
VIC1		3		2


Any help here please ?.....>>

Reply With Quote
  #10  
Old November 6th, 2004, 12:06 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 27,003 Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 17 h 17 m
Reputation Power: 1572
very simple:
Code:
 <%
  'delete:
  strSQL="Delete From JS Where shtnum=2"
  objConn.Execute(strSQL)
  
  'update:
  strSQL="Update JS Set shtnum=shtnum-1 Where shtnum>2"
  objConn.Execute(strSQL)
 %>
 


Reply With Quote
  #11  
Old November 7th, 2004, 09:47 AM
unicorn unicorn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Northern Ireland
Posts: 63 unicorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 47 m 50 sec
Reputation Power: 5
Access 97 limit

Aghhh!!..I hate it when u make things so simple..!!....thank u very much Shadow...one line of code replaced my 7. I had this for my delete....
Code:
 Query =("SELECT * FROM "&table1&" WHERE EstNo="&"'"&estno&"'" & "ORDER BY ShtNum")
ShepRS.Open Query,ConnDB,adOpenStatic, adLockOptimistic
ShepRS.MoveFirst
do until ShepRS("ShtNum") = abs(num)
   ShepRS.MoveNext
loop
ShepRS.Delete


the simple things are always the best...cul in my next thread..>>>

Reply With Quote
  #12  
Old November 7th, 2004, 09:54 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 27,003 Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342958 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 17 h 17 m
Reputation Power: 1572
lol
no problem, glad I was able to help!

Reply With Quote
Reply

Viewing: ASP Free Forums