Professional Web Applications Themes

Error: "Syntax error converting the varchar value..." - Microsoft SQL / MS SQL Server

I get the following error in my VB6 app when executing a stored proc: "Syntax error converting the varchar value of 'c:\email\attachments\' to a column of datatype int." Here is my stored proc: ==================================== CREATE Procedure [Proc_getSiteDir] ( usrPK int, usrSiteDir varchar(255) OUTPUT ) AS SELECT usrSiteDir = usr.usr_siteDir FROM usr WHERE (usrPK = usr.usr_PK) AND (usr.usr_activated = 1) RETURN usrSiteDir GO =================================== And the table schema is: usr_siteDir varchar(255) usr_PK int(4) usr_activated int(4) Any ideas on how I can resolve this? Thanks. MB...

  1. #1

    Default Error: "Syntax error converting the varchar value..."

    I get the following error in my VB6 app when executing a stored proc:

    "Syntax error converting the varchar value of 'c:\email\attachments\' to a
    column of datatype int."

    Here is my stored proc:
    ====================================
    CREATE Procedure [Proc_getSiteDir]
    (
    usrPK int,
    usrSiteDir varchar(255) OUTPUT
    )
    AS

    SELECT usrSiteDir = usr.usr_siteDir
    FROM usr
    WHERE (usrPK = usr.usr_PK) AND
    (usr.usr_activated = 1)

    RETURN usrSiteDir
    GO
    ===================================

    And the table schema is:
    usr_siteDir varchar(255)
    usr_PK int(4)
    usr_activated int(4)

    Any ideas on how I can resolve this?

    Thanks.

    MB




    Mike Guest

  2. #2

    Default Re: Error: "Syntax error converting the varchar value..."

    Please check your SP in Query yser, if you found no errors there, then
    try debugging the VB6 apps, it seems you are passing some non-numeric value
    as parameter value for usrPK .

    HTH
    Falik


    "Mike Brophy" <net> wrote in message
    news:%phx.gbl... 


    Falik Guest

  3. #3

    Default Error: "Syntax error converting the varchar value..."

    if you can, post the part of VB code where you call the
    procedure. The problem might be in there

     
    stored proc: 
    of 'c:\email\attachments\' to a 
    Lucian Guest

  4. #4

    Default Re: Error: "Syntax error converting the varchar value..."

    Here is the VB code calling the stored proc:
    ====================================
    Public Function phlog_getSiteDir(usrPK As Integer)
    '---These are wrapper functions of my own -----
    Set imgDBConn = phlog_DBFunctions.connectToDSN(phlog_dsnName)
    Set imgDBCmd = phlog_DBFunctions.createCommandObj
    '-------------------------------------------------
    Set imgDBCmd.ActiveConnection = imgDBConn
    imgDBCmd.CommandType = 4
    imgDBCmd.CommandText = "Proc_getSiteDir"
    imgDBCmd.Parameters(1) = usrPK
    imgDBCmd.Execute
    siteDir = imgDBCmd.Parameters(0)
    imgDBConn.Close
    Set imgDBConn = Nothing
    Set imgDBCmd = Nothing
    End Function
    =============================================


    Mike Guest

  5. #5

    Default Re: Error: "Syntax error converting the varchar value..."

    The RETURN statement can only return integers, you are trying to return a
    varchar. That is your problem.

    /SG
     


    Stefan Guest

  6. #6

    Default Re: Error: "Syntax error converting the varchar value..."

    The RETURN statement can only return an integer value.

    "Mike Brophy" <net> wrote in message
    news:#phx.gbl... 


    Anthony Guest

Similar Threads

  1. Help! Can not save anything in Illustrator format - Error message "unknown error has occured"
    By Laura_Hernandez@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 7
    Last Post: April 19th, 04:30 AM
  2. #38779 [NEW]: Engine crash when "require" file with syntax error through stream wrapper
    By alexander dot netkachev at gmail dot com in forum PHP Bugs
    Replies: 3
    Last Post: September 11th, 02:30 PM
  3. GD.c: 533: error: syntax error before "void"
    By Ken Rich in forum PERL Modules
    Replies: 2
    Last Post: March 28th, 03:40 PM
  4. pl/pgsql trigger: syntax error at or near "ELSEIF"
    By Roman Neuhauser in forum PostgreSQL / PGSQL
    Replies: 3
    Last Post: January 14th, 04:24 PM
  5. #12029 [Com]: "--with-apxs" can cause the error "MySQL: Unable to save result set in"
    By sietzepost at streetwisedd dot nl in forum PHP Development
    Replies: 1
    Last Post: October 3rd, 09:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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