Type Mismatch

Results 1 to 5 of 5

Thread: Type Mismatch

  1. #1
    Join Date
    Dec 1969

    Default Type Mismatch

    I am just curious as to why this comes up, is it different in each case that it comes up or is this a universal error. What does type mismatch mean and why does it come up. For reference, i am getting a Type mismatch: &#039Formatdatetime&#039<BR><BR>This makes no sense, what does it mean aaaaaarrrrrrgggghhhhh<BR><BR>thanks in advance

  2. #2
    Keith Fowler Guest

    Default RE: Type Mismatch

    A type mismatch is generated when you try to put a specific type of variable into another variable of a different type. Such as putting a DATE into a variable typed as an INTEGER.<BR><BR>Since VBScript uses the Variant, it doesn&#039t matter what kind of data you throw at it, you shouldn&#039t get a type mismatch from a variant.<BR><BR>That being said, your error is likely being generated by trying to put the wrong type of variable into the property of a server side COM component.<BR><BR>You can prevent this, by using the conversion functions inherent in VBScript. If you are capturing data from the Request.Form object, then all variables are strings. If you were to set the Property of your COM object with a string and it requires an Integer, then a &#039Type Mismatch&#039 would occur.<BR>

  3. #3
    bob clark Guest

    Default RE: Type Mismatch

    I have that problem.. How do I convert a string from a request.form into a variable???? I&#039ve looked in my VBscript books but can&#039t seem to find an answer

  4. #4
    Mr Swifty Guest

    Default RE: Type Mismatch

    Well, you don&#039t &#039convert&#039. <BR>A variable is an allocation of memory that can contain a value, which may be a string, number, etc.<BR>What you DO do is assign a value to a variable.<BR>In the case of forms:<BR><BR>strVar = request.form("NameOfStringParameter")

  5. #5
    Ian Stallings Guest

    Default RE: Type Mismatch

    &#062;Since VBScript uses the Variant, it doesn&#039t matter what kind of<BR>&#062;data you throw at it, you shouldn&#039t get a type mismatch from <BR>&#062;a variant.<BR><BR>Sorry not true-<BR><BR>&#060;%<BR><BR>y = 1<BR>z = "two"<BR>strExample = "Example"<BR><BR>varStr = mid(strExample,z,y)<BR>Response.write(varStr)<BR>< BR>%&#062;<BR><BR>You can get type mismatch in VBscript alone<BR>But everything else is correct. You should use <BR>conversion fucntions whenever you have to compare<BR>like data types. IE intergers, strings, etc.<BR>Especially when interacting with COM objects.<BR><BR><BR>Ian S<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