Reply
Refresh Combobox
Old 02-20-2006, 07:30 AM Refresh Combobox
Junior Talker

Posts: 1
Hi,

I would like to ask you about combobox refershing. My code is:

Code:
<title>none</title>
<body>

<table border="1" width="100%" cellspacing="0" cellpadding="2">
<%
dim m_DB
dim RS

set m_DB = Server.CreateObject("ADODB.Connection")
set RS = Server.CreateObject ("ADODB.Recordset")

m_DB.ConnectionString = "dsn=Test;"
m_DB.Open

i=1
%>
Select Site Code 
<select name="site" style="width: 250px" onchange="txt();">

<%if i=1 then%>
<%

RS.Open "select * from mrs ORDER by mrs.sites", m_DB

'mezok
do while not RS.EOF 

response.write("<option value='" & RS("sites") & "'>" & RS("sites"))

RS.MoveNext
loop
RS.Close

%>
<%end if%>

</select>
<script language="VBScript">
dim prevscode


function txt()

'msgbox "sfs"
'msgbox site.value
prevscode = site.value
table.value = site.value

End function

function adding()

Dim Con
Dim strQuery 
Dim rst 
 
Set con = CreateObject("ADODB.Connection") 
con.Open "Provider=sqloledb;Data Source=eurdsql1; Initial Catalog=EURsEDD_MRS;Integrated Security = SSPI;" 

strQuery="INSERT INTO sites VALUES ('" & table.value & "')" 
Set rst = con.Execute(strQuery) 
table.value=""
rst.close
con.close

end function

</script>

</table>

<br>
<table border="1" width="80px" cellspacing="1" cellpadding="2">
<input type="text" name="table" value="" style="width: 90px">
</table>
<br>
<input type="submit" name="action1" value="Insert Site" onclick="adding()" style="width: 90px">
<input type="submit" name="action2" value="Delete Site" onclick="deletes()" style="width: 90px">
<input type="submit" name="action3" value="Modify Site" onclick="ch()" style="width: 90px">

</body>
How can O silve, that the values of the combobox always refresh from database, what I declare at the top, when I click on a "Refresh" button?

Thanks.
sici22 is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Old 02-21-2006, 02:19 PM Re: Refresh Combobox
chrishirst's Avatar
Super Moderator

Posts: 10,598
Location: Blackpool. UK
not sure what you are asking, and your code above won't work at all because you are trying to run server side code clientside
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-19-2008, 02:50 PM Re: Refresh Combobox
Junior Talker

Posts: 4
Name: dragon
Quote:
Originally Posted by chrishirst View Post
not sure what you are asking, and your code above won't work at all because you are trying to run server side code clientside
he's right
__________________
ZRevolution | DbzForce | Dbz
dbzanime is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Reply     « Reply to Refresh Combobox
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML


Page generated in 0.13407 seconds with 14 queries