473,385 Members | 1,958 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.

how to find all values in particularly product ID

Fary4u
273 100+
Hi know ?
how to find all colors_id in product_colours again particularly prod_id

Expand|Select|Wrap|Line Numbers
  1. Dim SQL1, rsColours
  2. 'which one is the best way to doing it ?
  3. SQL1 = "select * from product_colours where prod_id='" & pd & "'"
  4. or
  5. SQL1 = "select * from colors,product_colours where colors.id = color_id and prod_id='" & pd & "'"
  6.  
  7. set rsColours = Server.CreateObject("ADODB.RecordSet")
  8. rsColours.open SQL1, ConString,adOpenKeyset,adLockReadOnly
  9.  
  10. Do While not rsColours.EOF
  11.     rsColours("color_id")
  12.     rsColours.MoveNext
  13. Loop
  14.  
  15. i need to change the following values to checked or not checked ?
  16.  
  17. <input type="checkbox" name="3" value="3" 
  18. <% If rsColours("color_id") = "3" Then Response.Write "checked" end if %>>
  19.  
  20. <input type="checkbox" name="4" value="4" 
  21. <% If rsColours("color_id") = "4" Then Response.Write "checked" end if %>>
  22.  
  23. so on & so 4th . . .
  24.  
thx in advance
Oct 24 '07 #1
9 1564
Hi know ?
how to find all colors_id in product_colours again particularly prod_id

Expand|Select|Wrap|Line Numbers
  1. Dim SQL1, rsColours
  2. 'which one is the best way to doing it ?
  3. SQL1 = "select * from product_colours where prod_id='" & pd & "'"
  4. or
  5. SQL1 = "select * from colors,product_colours where colors.id = color_id and prod_id='" & pd & "'"
  6.  
  7. set rsColours = Server.CreateObject("ADODB.RecordSet")
  8. rsColours.open SQL1, ConString,adOpenKeyset,adLockReadOnly
  9.  
  10. Do While not rsColours.EOF
  11.     rsColours("color_id")
  12.     rsColours.MoveNext
  13. Loop
  14.  
  15. i need to change the following values to checked or not checked ?
  16.  
  17. <input type="checkbox" name="3" value="3" 
  18. <% If rsColours("color_id") = "3" Then Response.Write "checked" end if %>>
  19.  
  20. <input type="checkbox" name="4" value="4" 
  21. <% If rsColours("color_id") = "4" Then Response.Write "checked" end if %>>
  22.  
  23. so on & so 4th . . .
  24.  
thx in advance
Hi , Fary
If your product_colors table contains both color_id and product_id then you can use this code;
Expand|Select|Wrap|Line Numbers
  1. SQL1 = "SELECT color_id FROM product_colors WHERE product_id ="'" & pd "'"
Godd day
Oct 25 '07 #2
Fary4u
273 100+
Hi thank for reply

Expand|Select|Wrap|Line Numbers
  1. Dim SQL1, rsColours
  2. SQL1 = "SELECT color_id FROM product_colours WHERE prod_id ='" & pd & "'"
  3. set rsColours = Server.CreateObject("ADODB.RecordSet")
  4. rsColours.open SQL1, ConString,adOpenKeyset,adLockReadOnly
  5.     Do While not rsColours.EOF
  6.         rsColours("color_id")
  7.     rsColours.MoveNext
  8.     Loop
  9.  
it's not working mean rsColours("color_id") not taking any value it's giving me this error ?
Expand|Select|Wrap|Line Numbers
  1. Error Type:
  2. Microsoft VBScript runtime (0x800A01C2)
  3. Wrong number of arguments or invalid property assignment
  4. /localhost/edit.asp, line 6
  5.  
any solution ?
Oct 25 '07 #3
Hi thank for reply

Expand|Select|Wrap|Line Numbers
  1. Dim SQL1, rsColours
  2. SQL1 = "SELECT color_id FROM product_colours WHERE prod_id ='" & pd & "'"
  3. set rsColours = Server.CreateObject("ADODB.RecordSet")
  4. rsColours.open SQL1, ConString,adOpenKeyset,adLockReadOnly
  5.     Do While not rsColours.EOF
  6.         rsColours("color_id")
  7.     rsColours.MoveNext
  8.     Loop
  9.  
it's not working mean rsColours("color_id") not taking any value it's giving me this error ?
Expand|Select|Wrap|Line Numbers
  1. Error Type:
  2. Microsoft VBScript runtime (0x800A01C2)
  3. Wrong number of arguments or invalid property assignment
  4. /localhost/edit.asp, line 6
  5.  
any solution ?
Hi , Fary
Just put a response statement after the query and see if it's working properly or not. Only output will be the Query and then copy it and try it in SqlQuery analyzer, If the Query ok or not.
Thanks.
Oct 26 '07 #4
Fary4u
273 100+
Hi their is no problem to execute this code but
if i'll do this in select statment
Expand|Select|Wrap|Line Numbers
  1. <select size="1"><%Do While Not rscolours.EOF %>
  2.  
  3. <option value="<%= rssize2("color_id")%>"><%= rssize2("color_id")%></option>
  4. <%
  5.     rscolours.MoveNext
  6.     loop
  7. %></select><% rsColours.MoveNext
  8. Loop
  9.  BUT IF I USE THIS CODE
  10.  
  11.     Do While not rsColours.EOF
  12.         rsColours("color_id") ' this line is error ?
  13.     rsColours.MoveNext
  14.     Loop
  15.  
  16. MY MAIN PROBLEM THIS 
  17. i need to change the following values to checked or not checked ?
  18.  
  19. <input type="checkbox" name="3" value="3" 
  20. <% If rsColours("color_id") = "3" Then Response.Write "checked" end if %>>
  21.  
  22. <input type="checkbox" name="4" value="4" 
  23. <% If rsColours("color_id") = "4" Then Response.Write "checked" end if %>>
  24.  
that's not working . . . any solution for to over come this ?

Regards
Farhan
Oct 26 '07 #5
Hi their is no problem to execute this code but
if i'll do this in select statment
Expand|Select|Wrap|Line Numbers
  1. <select size="1"><%Do While Not rscolours.EOF %>
  2.  
  3. <option value="<%= rssize2("color_id")%>"><%= rssize2("color_id")%></option>
  4. <%
  5.     rscolours.MoveNext
  6.     loop
  7. %></select><% rsColours.MoveNext
  8. Loop
  9.  BUT IF I USE THIS CODE
  10.  
  11.     Do While not rsColours.EOF
  12.         rsColours("color_id") ' this line is error ?
  13.     rsColours.MoveNext
  14.     Loop
  15.  
  16. MY MAIN PROBLEM THIS 
  17. i need to change the following values to checked or not checked ?
  18.  
  19. <input type="checkbox" name="3" value="3" 
  20. <% If rsColours("color_id") = "3" Then Response.Write "checked" end if %>>
  21.  
  22. <input type="checkbox" name="4" value="4" 
  23. <% If rsColours("color_id") = "4" Then Response.Write "checked" end if %>>
  24.  
that's not working . . . any solution for to over come this ?

Regards
Farhan
Hi , Fary
Could you please give me a comprehensive description about your table structures.
That is the tables you are using with all their column names, etc.
Thanks.
Oct 27 '07 #6
Fary4u
273 100+
DATABASE CONTAINS ( Product ID & Color ID )
like Product ID 22 , 23 , 24 . . . n
but
Color ID available for each product ID with multipule Colors Black(1), Blue(2), Brown(3) . . . Yellow(n) Etc.

the following code taking values from prod_id = 23 AND
all it's colors which is Black(1), Blue(2), Brown(3) . . . Yellow(n)

Expand|Select|Wrap|Line Numbers
  1. <%
  2. pd = 23
  3. SQL1 = "SELECT * from PRODUCT_SIZES where prod_id='" & pd & "'"
  4. set rsColours = Server.CreateObject("ADODB.RecordSet")
  5. rsColours.open SQL1, ConString,adOpenKeyset,adLockReadOnly
  6. %>
  7. <input type="checkbox" name="1" value="2" <% If rsColours("color_id") = "2" Then Response.Write "checked" end if %>>
  8. <input type="checkbox" name="2" value="3" <% If rsColours("color_id") = "3" Then Response.Write "checked" end if %>>
  9. .
  10.  .
  11.   .
  12. <input type="checkbox" name="n" value="n" <% If rsColours("color_id") = "n" Then Response.Write "checked" end if %>>
  13.  
after execute it's bring check & uncheck values from final page
Oct 29 '07 #7
DATABASE CONTAINS ( Product ID & Color ID )
like Product ID 22 , 23 , 24 . . . n
but
Color ID available for each product ID with multipule Colors Black(1), Blue(2), Brown(3) . . . Yellow(n) Etc.

the following code taking values from prod_id = 23 AND
all it's colors which is Black(1), Blue(2), Brown(3) . . . Yellow(n)

Expand|Select|Wrap|Line Numbers
  1. <%
  2. pd = 23
  3. SQL1 = "SELECT * from PRODUCT_SIZES where prod_id='" & pd & "'"
  4. set rsColours = Server.CreateObject("ADODB.RecordSet")
  5. rsColours.open SQL1, ConString,adOpenKeyset,adLockReadOnly
  6. %>
  7. <input type="checkbox" name="1" value="2" <% If rsColours("color_id") = "2" Then Response.Write "checked" end if %>>
  8. <input type="checkbox" name="2" value="3" <% If rsColours("color_id") = "3" Then Response.Write "checked" end if %>>
  9. .
  10.  .
  11.   .
  12. <input type="checkbox" name="n" value="n" <% If rsColours("color_id") = "n" Then Response.Write "checked" end if %>>
  13.  
after execute it's bring check & uncheck values from final page
Hi Fary,
Expand|Select|Wrap|Line Numbers
  1. pd_id = 2
  2. Set Conn = Server.CreateObject("ADODB.Connection")
  3. Conn.ConnectionString = "Provider=SQLOLEDB;" & _
  4.                         "Data Source=" & DATABASE_SERVER & ";" & _
  5.                         "Initial Catalog=" & DATABASE_NAME & ";" & _
  6.                         "User ID=" & DATABASE_USER & ";" & _
  7.                         "Password=" & DATABASE_PASSWORD & ";" & _
  8.                         "Persist Security Info=false;"
  9. Conn.Open '//Open Connection
  10. SQL1 = "SELECT * FROM TABLE_NAME WHERE product_id = '" & pd_id & "'"
  11. set rsColours = Server.CreateObject("ADODB.RecordSet")
  12. set rsColours = Conn.Execute(SQL1)
  13. count = 0
  14. dim str()
  15. while not rsColours.EOF
  16. if count = 0 then
  17.     redim str(0)
  18.     str(count) = rsColours("color_id")
  19. else
  20.     redim preserve str(count)
  21.     str(count) = rsColours("color_id")
  22. end if
  23. rsColours.MoveNext
  24. count = count + 1
  25. Wend
  26. t = ubound(str)
  27. %>
  28. <input type="checkbox" name="1" value="1"
  29. <%
  30. for i = 0 to t
  31. If str(i) = 1 then
  32. response.write("checked")
  33. end if
  34. next
  35. %>/>
  36. <input type="checkbox" name="2" value="2"
  37. <%
  38. for i = 0 to t
  39. If str(i) = 2 then
  40. response.write("checked")
  41. end if
  42. next
  43. %>/>
  44. <input type="checkbox" name="3" value="3"
  45. <%
  46. for i = 0 to t
  47. If str(i) = 3 then
  48. response.write("checked")
  49. end if
  50. next
  51. %>/>
  52. <input type="checkbox" name="4" value="4"
  53. <%
  54. for i = 0 to t
  55. If str(i) = 4 then
  56. response.write("checked")
  57. end if
  58. next
  59. %>/>
  60. <input type="checkbox" name="5" value="5"
  61. <%
  62. for i = 0 to t
  63. If str(i) = 5 then
  64. response.write("checked")
  65. end if
  66. next
  67. %>/>
  68. <input type="checkbox" name="6" value="6"
  69. <%
  70. for i = 0 to t
  71. If str(i) = 6 then
  72. response.write("checked")
  73. end if
  74. next
  75. %>/>
  76. <input type="checkbox" name="7" value="7"
  77. <%
  78. for i = 0 to t
  79. If str(i) = 7 then
  80. response.write("checked")
  81. end if
  82. next
  83. %>/>
I have modified your code.
Just take a look.
You can make connection as you like.

Inform if any problem
Have a good day !
Nov 2 '07 #8
Fary4u
273 100+
Hi

Thanks for the code it's well worth it which i'm trying 2 do

onec again realy thx for you participation

if possible plz take a look following code it's same part of the coding

http://www.thescripts.com/forum/thread731823.html
Nov 2 '07 #9
Hi

Thanks for the code it's well worth it which i'm trying 2 do

onec again realy thx for you participation

if possible plz take a look following code it's same part of the coding

http://www.thescripts.com/forum/thread731823.html
Hi Fary
You are most welcome.
have a good day.
Nov 5 '07 #10

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

Similar topics

50
by: sabarish | last post by:
Hi to all. find out the biggest among two numbers without using any conditional statements and any relational operators.
29
by: John Wood | last post by:
Even though CSC does its best to detect use of unassigned variables, it often misses it... for example if you just declare a double in a class without assigning a default value, it has a default...
12
by: Roy Gourgi | last post by:
Hi, How can I insert variables instead of values in the VALUES() part of the insert into command, i.e. var1=10; var2=20; var3=30 insert into emp_test (emp_no1, emp_no2, emp_no3) VALUES...
4
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to...
5
by: ventre-à-pattes | last post by:
I have no idea where to look for this. Database about wines. One table is `product` (one particular wine from one particular estate) with a link to a second table `appellation` (legal...
13
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format...
4
by: Chuy08 | last post by:
If I have a multdimensional array like so: $records = array( array('product' ='30 year','rate'=6.0 'ProgramID' =>9514), array('product' ='30 year','rate'=6.0 'ProgramID' =>9514),...
2
by: dancole42 | last post by:
So I have a subform that lists the various items on a particular invoice. First, the user selects a product class from the Class dropdown. This is bound to the Class field in the InvioceLines...
9
by: Satish Itty | last post by:
How do I write the following c# code in vb Product FindProduct(string code) { List<Productproducts = getProducts(); return products.Find(delegate(Product bo) { return bo.Code == code; }); }
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.