Data type conversion problems

Results 1 to 6 of 6

Thread: Data type conversion problems

  1. #1
    Ed B Guest

    Default Data type conversion problems

    Dear Assembled ASP gurus,<BR><BR>I am close to tears. Having cut and pasted a bit of code from one ASP page to another, I find it no longer works. I get an error message that has haunted me since starting to code ASP, "type mismatch". The data I am passing to the page is the width & height of an image in pixels, ie a numerical value, not in double quotes. The page is assuming it is a string.<BR>I realise that the server is telling me I can&#039t do maths on what it assumes to be a string, but why should it work on one page and not another? The two code snippets are identical.<BR>I have tried CDbl(variant_name) etc only to find that this itself returns "type mismatch". A function I wrote to convert the data to a numerical variant sub-type just fails for, presumably, the same reason.<BR>Why? How do I get round this? Please help me.....

  2. #2
    New ASP Guest

    Default RE: Data type conversion problems

    I have the same prob. before.<BR><BR>My reason is: When I copy some code from one to another.<BR>It changes to NON-TEXT file. The part asp code changed to word.doc format file. So, what I did is just copy all the code from InterDev to NotePad to make sure it still is TXT-ASP file.<BR>Then Save As to my.asp ...<BR><BR>Hope can help you, good luck! Let me know if it works!!<BR><BR><BR>

  3. #3
    Ed B Guest

    Default RE: Data type conversion problems

    Many thanks for a quick response. However, I have done all my coding in Notepad so far, so I don&#039t think this is it. I shan&#039t rule it out yet though.<BR><BR>Thanks,<BR><BR>Ed B

  4. #4
    KPW Guest

    Default CODE PLEASE

    Would it be feasible to post the code for both of the pages in question? It seems that something outside of the code snippet you cut/pasted is causing one ASP page to regard your data as numeric while the other treats it as a string. Without seeing your code, however, all we can do is guess at what the problem might be.

  5. #5
    Ed B Guest

    Default RE: CODE PLEASE

    The code is as follows, identical on both pages. The reference to "oSis" is a GIS mapping component. I am allowing the user to set the map size as they wish from a list of options in a SELECT form element.<BR><BR>On the new page, the code fails when it tries to divide the width of the map (in real world co-ordinates) by the value of w (a width in pixels) - pix_width = (x2 - x1) / w in the code below.<BR><BR>w = Request.Form("width")<BR>h = Request.Form("height")<BR><BR>&#039=== Scale bar width calculation<BR><BR>&#039 get width & height in x & y<BR> oSis.SplitExtent x1,y1,z1,x2,y2,z2,oSis.GetViewExtent<BR><BR> bar_width = 1000<BR> pix_width = (x2 - x1) / w<BR><BR> scale_factor = bar_width / pix_width<BR><BR> While scale_factor &#062; 250<BR> bar_width = (bar_width / 2)<BR> scale_factor = bar_width / pix_width<BR> Wend<BR><BR> While scale_factor &#060; 100<BR> bar_width = (bar_width * 2)<BR> scale_factor = bar_width / pix_width<BR> Wend

  6. #6
    sm549 Guest

    Default RE: CODE PLEASE

    Are you sure that those form variables exist in the other form? If you :<BR><BR>&nbsp&nbspResponse.Write "&ltBR&gtWt=" & Request.Form("width") <BR>&nbsp&nbspResponse.Write "&ltBR&gtHt=" & Request.Form("height") <BR><BR>what do you see?<BR><BR>&#060;reqd&#062;Views expressed are not necessarily those of my employer.&#060;/reqd&#062;<BR>

Posting Permissions

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