473,698 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refresh Combobox in ASP

1 New Member
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 5520

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

Similar topics

0
1387
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 load of 'Invoice Form'. Bind it to the combobox, select the appropriate staff id.
7
11142
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 values for the second combo box (B) from a database. However, when I choose a value from the first combo box (A), the second combo box (B) populates as required, but if i change my mind about the selection from the first combo box (A) , the second...
0
2044
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 the available information based on the second combo box selection. But if I change my mind and select a different item in the second box, after the third box has been populated, the third box still retains the information that was previously...
1
18113
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. However, while my program is running and I add a new object to that ArrayList - this ComboBox is not updating to reflect the change. I have gone so far as to try: clientList.Invalidate();
3
4268
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 a form that pops up when the user dbl-clicks a combobox. ' This popup form displays the table that the combobox uses. The user can change the content, and the combobox ' rowsource in-turn will change. This all works great in my mainform, but...
34
20205
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 being opened via the standard DoCmd call. I've tried adding Requery in AfterUpdate, Form_Current, etc. to no avail.... The test form has the combobox and a command button. Here's my test code: Private Sub cmdAddCatgCd_Click() On Error GoTo...
3
4750
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
3160
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. After I load the form when I select an item from 1st one it will generate list for 2nd one, then I select an item from 2nd one it will generate list for 3nd one. Uptil this, all r done well. But after these selection if I change the selection of 1st...
4
2459
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 indicates if the record has been selected. When user1 selects the record from the combobox, the field is updated that the record has been selected. If user2 tries to select that same record, they get a warning that user1 has selected it and...
0
8675
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7729
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.