Value can not be converted to requested type.

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Value can not be converted to requested type.

    Having a peculiar problem running a MS-SQL 2000 Stored Procedure in CFMX6.1.
    SP works perfectly in Query Analyzer and has the right permissions for the web
    DSN to execute it. However I keep getting [Macromedia][SQLServer JDBC
    Driver]Value can not be converted to requested type. on the last CFPROCPARAM
    line when I try and run it in CF. Google on this phrase yields a MS-SQL issue
    with non-null properties of fields in the DB. I have gone back and changed all
    my fields to accept null values. That has not solved the problem. Am I doing
    something stupid? Any insight would be much appreciated. Thanks. S Code
    snippets attached..

    Stored Procedure
    =============
    CREATE PROCEDURE sp_InsertNewUser


    @txtFName varchar(50),
    @txtLName varchar(50),
    @txtUserName varchar(50),
    @txtPassword varchar(50),
    @txtEmail varchar(50),
    @txtCode varchar(50),
    @intSchoolID int,
    @intUserID int OUTPUT

    AS

    INSERT INTO tblUser (txtFName, txtLName, txtUserName, txtPassword, txtEmail,
    intSchoolID, txtCode)
    VALUES (@txtFName, @txtLName, @txtUserName, @txtPassword, @txtEmail,
    @intSchoolID, @txtCode)

    SELECT @intUserID = @@IDENTITY
    GO


    Code snippet
    ===========
    <cfstoredproc datasource="#DSN#" procedure="sp_InsertNewUser"
    returncode="Yes">
    <cfprocparam cfsqltype="CF_SQL_CHAR" dbvarname="txtFName"
    value="#form.txtFName#" type="In">
    <cfprocparam cfsqltype="CF_SQL_CHAR" dbvarname="txtLName"
    value="#form.txtLName#" type="In">
    <cfprocparam cfsqltype="CF_SQL_CHAR" dbvarname="txtUserName"
    value="#form.txtUserName#" type="In">
    <cfprocparam cfsqltype="CF_SQL_CHAR" dbvarname="txtPassword"
    value="#form.txtPassword1#" type="In">
    <cfprocparam cfsqltype="CF_SQL_CHAR" dbvarname="txtEmail"
    value="#form.txtEmail#" type="In">
    <cfprocparam cfsqltype="CF_SQL_CHAR" dbvarname="txtCode"
    value="#form.txtCode#" type="In">
    <cfprocparam cfsqltype="CF_SQL_INTEGER" dbvarname="intSchoolID"
    value="#form.intSchoolID#" type="In">
    <cfprocparam cfsqltype="CF_SQL_INTEGER" dbvarname="intUserID"
    variable="intUserID" type="Out">
    </cfstoredproc>

    SuperDud Guest

  2. Similar Questions and Discussions

    1. Object of type 'System.String' cannot be converted to type 'System
      I'm trying to get a control from metabuilders.com dual list)to work under ASP.NET 2.0. It worked find under 1.1 and then when i migrated my...
    2. Query help requested
      My boss has decided that he wants to mimic Gantt charts in our database, but he's adamant about using the db so people can search. So, I've built...
    3. [11004] Valid name, no data record of requested type -ASPMAIL
      hello, I am getting the following error message Valid name, no data record of requested type when i run the following ASP MAIL script, why?...
    4. Requested resource in use
      Win2K latest service packs IIS 5.0 Connecting to an Access DB *2003)- simple userlogin page, checks userpass & ID I'm all of a sudden getting the...
    5. why is . converted to _ in $_POST
      I have a form that contains some file names (eg this.jpg). When the form posts, and i ready $_POST, I get back this_jpg. What is happening? how...
  3. #2

    Default Re: Value can not be converted to requested type.

    Try cfsqltype as cf_sql_varchar and see if that solves the issue. Also try
    the return variable as InOut. I think if it's OUT only there may be an issue,
    or you could set a default for the value in the proc @intUserid int OUTPUT =
    null.

    byron1021 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139