473,387 Members | 1,549 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,387 software developers and data experts.

Refresh Combobox in ASP

Hi all,

I would like to ask you about combobox refershing. My code is:
Expand|Select|Wrap|Line Numbers
  1. <title>none</title>
  2. <body>
  3.  
  4. <table border="1" width="100%" cellspacing="0" cellpadding="2">
  5. <%
  6. dim m_DB
  7. dim RS
  8.  
  9. set m_DB = Server.CreateObject("ADODB.Connection")
  10. set RS = Server.CreateObject ("ADODB.Recordset")
  11.  
  12. m_DB.ConnectionString = "dsn=Test;"
  13. m_DB.Open
  14.  
  15. i=1
  16. %>
  17. Select Site Code 
  18. <select name="site" style="width: 250px" onchange="txt();">
  19.  
  20. <%if i=1 then%>
  21. <%
  22.  
  23. RS.Open "select * from mrs ORDER by mrs.sites", m_DB
  24.  
  25. 'mezok
  26. do while not RS.EOF 
  27.  
  28. response.write("<option value='" & RS("sites") & "'>" & RS("sites"))
  29.  
  30. RS.MoveNext
  31. loop
  32. RS.Close
  33.  
  34. %>
  35. <%end if%>
  36.  
  37. </select>
  38. <script language="VBScript">
  39. dim prevscode
  40.  
  41.  
  42. function txt()
  43.  
  44. 'msgbox "sfs"
  45. 'msgbox site.value
  46. prevscode = site.value
  47. table.value = site.value
  48.  
  49. End function
  50.  
  51. function adding()
  52.  
  53. Dim Con
  54. Dim strQuery 
  55. Dim rst 
  56.  
  57. Set con = CreateObject("ADODB.Connection") 
  58. con.Open "Provider=sqloledb;Data Source=eurdsql1; Initial Catalog=EURsEDD_MRS;Integrated Security = SSPI;" 
  59.  
  60. strQuery="INSERT INTO sites VALUES ('" & table.value & "')" 
  61. Set rst = con.Execute(strQuery) 
  62. table.value=""
  63. rst.close
  64. con.close
  65.  
  66. end function
  67.  
  68. </script>
  69.  
  70. </table>
  71.  
  72. <br>
  73. <table border="1" width="80px" cellspacing="1" cellpadding="2">
  74. <input type="text" name="table" value="" style="width: 90px">
  75. </table>
  76. <br>
  77. <input type="submit" name="action1" value="Insert Site" onclick="adding()" style="width: 90px">
  78. <input type="submit" name="action2" value="Delete Site" onclick="deletes()" style="width: 90px">
  79. <input type="submit" name="action3" value="Modify Site" onclick="ch()" style="width: 90px">
  80.  
  81. </body>
  82.  
How can I solve, that the values of the combobox always refresh from database, what I declare at the top, when I click on a "Refresh" button?

Thanks.
Feb 20 '06 #1
0 5500

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

Similar topics

0
by: Hyper X | last post by:
Hey guys, I have about 150 forms using the ComboBoxes. There is at least one combobox in every form. I am filling the comboboxes on FormLoad of every form. Eg., Fill Staff table on form...
7
by: Doug | last post by:
Hi I have a combo box (A) that populates a following combo box (B) based on a selection. The selection from the first combo box (A) initiates an OleDbDataAdapter routine that extracts the...
0
by: Doug | last post by:
This is a repost of an item that I still cannot resolve. I have 3 combo boxes. The first leads to the second to the third. When I have selected a value in the second box, the third box shows...
1
by: MrNobody | last post by:
I have a ComboBox on my form, and I set it's DataSource to an ArrayList of custom objects. Everything loads fine, all the entries I initially loaded into the ArrayList appear in my ComboBox. ...
3
by: ApexData | last post by:
COMBOBOX REFRESH DILEMMA ' I have been working for hours trying to figure out how to requery a combobox in a subform, from a Popup form ' that this subform had launched. Basically, I designed...
34
by: bitsnbytes64 | last post by:
Hi, I've been having a similar issue to what is described in the "refresh a form" post with a ComboBox that is not being refreshed after adding a new value on a seperate form. The second form is...
3
by: fran_j_diaz | last post by:
Hye, I've got some problems in developping web sites with Visual Studio 2005 (ASP.net & C#) and the Microsoft Ajax library. In my webpage default.aspx
2
by: billa856 | last post by:
Hi, My project is in MS Access. In that I have one Form in which I have some Comboboxes. 1st one is Independent, 2nd one is dependent on first one, 3rd one is dependent on 1st and 2nd both....
4
by: EManning | last post by:
Using A2003 w/ tables linked to SQL Server. All users have their own copy of the mdb. I have a combobox whose rowsource is a query. This query is based on a table and has a field in it that...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.