Ubound error

Results 1 to 3 of 3

Thread: Ubound error

  1. #1
    Join Date
    Dec 1969

    Default Ubound error

    why am i geting a type mismatch error?<BR><BR> DIM subjectSQL, subjectConn, subjectQuery, subjectData, numofRows, iii<BR> <BR> subjectSQL = "SELECT * FROM subject Where fk_titleid=&#039;" & indexselect & "&#039;ORDER BY fk_titleid"<BR> <BR> SET subjectConn = Server.CreateObject("ADODB.Connection")<BR> subjectConn.Open camconn<BR> SET subjectQuery = subjectConn.Execute(subjectSQL)<BR> IF subjectQuery.EOF THEN<BR> <BR> ELSE<BR> subjectData = subjectQuery.GetRows<BR> END IF<BR> SET subjectQuery = Nothing<BR> subjectConn.Close<BR> SET subjectConn = Nothing<BR> <BR> SUB showsubjects(subjectArr)<BR> numofRows = UBOUND(subjectData,2)<BR><BR> FOR iii = 0 TO numofRows<BR> Response.Write " &#060;option value=""" & subjectArr(1, iii) & """&#062;" & subjectArr(0, iii) & "&#060;/option&#062;" & vbCrLf<BR> NEXT<BR> END SUB<BR>

  2. #2
    Join Date
    Dec 1969

    Default look at your DIM statements

    UBound is for arrays........

  3. #3
    Join Date
    Dec 1969

    Default RE: Ubound error

    Hi,<BR><BR>I am of the impression that u need to know the number of records that was returned by your query. is it? and then display them as select list?<BR><BR>But u have not declared the variable subjectData as ARRAY type...<BR>Declare it explicitly and then equate it. <BR><BR>The next option is to use proper locks and recordsettypes for ur SQL statement and then use rs.recordcount to get the number of rows.<BR><BR>regards<BR>sujgan@hotmail.com

Posting Permissions

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