JanMoller81 Posted August 27, 2013 Share Posted August 27, 2013 Hi. I am currently trying to use VBScript to extract data from an SQL and insert it into ASP DropDown. Im almost done but for some reason it wont show the value of any of the dropdown values. It does, however, show the correct number of values and http://www.google.com is opening on click. What am I doing wrong? I have listed the ASP file below and attached an SD of how the dropdown looks. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <head> <title>Jan & Lines regnskab</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="description" content="Jan & Lines regskabsprogram" /> <meta name="keywords" content="Jan, Aase, Regnskab" /> <meta name="author" content="Jan Aase" /> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/> </head> <body> <% action = Request.querystring("action") if action = "post" then SQLServer = "xxxxxxxxxx" SQLDB = "xxxxxx" SQLUSER = "xxxxxx" SQLPass = "xxxx" StrcnnVer12 = "Provider=sqloledb;" & _ "Data Source= " & SQLServer & ";Initial Catalog= " & SQLDB & " ;User Id= " & SQLUSER & " ;Password= " & SQLPass & " ;" Set chkto = CreateObject("ADODB.Recordset") sql = "select * from Chkto" chkto.CursorLocation = 2 chkto.LockType = 1 chkto.MaxRecords = Max chkto.Open sql, StrcnnVer12, 0, 1 %> <div style="position:absolute; color:#000000; left:10%; top:270px; width:80%; height:50%; z-index:2; overflow: auto; border:2px solid black"> <select name="Vælg her" size="1" onchange="window.location.href = (this.options[this.selectedIndex].value)"> <% While Not chkto.EOF KKtonr = Trim(chkto.Fields("KKtonr")) Ktext = Trim(chkto.Fields("KText")) %> <option value="http://www.google.dk"><%Trim(chkto.Fields("KText"))%></option> <% chkto.MoveNext Wend chkto.Close Set chkto = Nothing end if %> </select> </div> </body></html> Link to comment Share on other sites More sharing options...
justsomeguy Posted August 27, 2013 Share Posted August 27, 2013 <%Trim(chkto.Fields("KText"))%> doesn't do anything, if you want to write that out either use response.write or the <%= opening tag. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now