CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Mar 2009

    Angry dynamically filling a select option

    I am trying to create a form that will dynamically fill a select list from information retrieved as a recordset from a sql database. I seem to retrieve the information fine. The problem is loading it into the select statement. I am using a vbscript to get the recordset and loop through it and than passing the datavalue that I want listed in the select list to a javascript to add it the select. Where I am having problems with is when I pass the variable to the Javascript it tells me type mismatch on loadselect. Here is the pertinent code. Any help would be greatly appreciated.

    	<script type="text/javascript">
        Function LoadSelect(team)
               msgbox "in LoadSelect";
    	   oSelect = document.getElementById("Ugroups");
    	   objNewOption = document.createElement("OPTION");
    	   objNewOption.Value = team.value;
    	   objNewOption.Text = team.value;
        <script type="text/vbscript">
        Function Load(document)
        Dim oConn, oRS, strConn
    	Set oRS = CreateObject("ADODB.Recordset")
    	Set oConn = CreateObject("ADODB.Connection")
    	strConn = "Driver={SQL Native .....
    	oConn.Open strConn
    	strSQL = "select ......
    	set oRS = oConn.Execute(strSQL)
    	Do while not oRS.eof
    		dim grpstr
            grpstr = ""
    		msgbox Trim(oRS.Fields("gname"))
    		grpstr = Trim(oRS.Fields("gname"))
            LoadSelect grpstr
    	set oConn = nothing
    end Function
      <select id="Ugroups" size="1" style="background-color:#ffff99" name="Ugroups" >
    Last edited by PeejAvery; March 4th, 2009 at 08:26 AM. Reason: Added code tags.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)