Passing a adGuid parameter to a SP... 
Author Message
 Passing a adGuid parameter to a SP...

Does anyone know why I get this error and what should be changed?
The error is : Syntax error converting from a character string to
uniqueidentifier.

        Dim cmdADO as ADODB.Command
        Dim strUserId as string

        strUserId = "{B69AE88F-9B92-11D4-B02F-00508BD6A189}"
        Set cmdADO = New ADODB.Command

        With cmdADO
                .ActiveConnection = ActiveConnection
                .CommandType = adCmdStoredProc
                .CommandText = "SD_TEST"
        End With

        Set parADOUserId = New ADODB.Parameter

adParamInput, 72, Trim$(strUserId))
        cmdADO.Parameters.Append parADOUserId

        With cmdADO
            .Execute
        End With

        Set parADOUserId = Nothing
        Set cmdADO = Nothing

Tx,
Kurt

--
__________
Kurt Lefevre
Tech Data NV/SA Belgium


http://www.*-*-*.com/



Sun, 25 Jan 2004 18:21:29 GMT  
 Passing a adGuid parameter to a SP...
Everything looks pretty good but I would setup the input parameter to
16 instead of 72 and lose the Trim$(strUserID) (not that the Trim
should matter but just to be safe).  Also - if this doesn't work then
create the SQL query in your SQL Analyzer or comparable such as:

EXEC sp_insert_tbl_user
"{BABE746B-6C3C-492A-82D0-5FAF15B09BD3}","1/1/2001","My User"

And see if that works properly.  My example of sp_insert_tbl_user
looks like this:

CREATE PROCEDURE dbo.sp_insert_tbl_user



AS
INSERT .tbl_user (
  [user_id] ,
  create_date ,
  description  )
  VALUES (



GO

Hope this helps you figure it out.

Dan

Quote:

> Does anyone know why I get this error and what should be changed?
> The error is : Syntax error converting from a character string to
> uniqueidentifier.

>         Dim cmdADO as ADODB.Command
>         Dim strUserId as string

>         strUserId = "{B69AE88F-9B92-11D4-B02F-00508BD6A189}"
>         Set cmdADO = New ADODB.Command

>         With cmdADO
>                 .ActiveConnection = ActiveConnection
>                 .CommandType = adCmdStoredProc
>                 .CommandText = "SD_TEST"
>         End With

>         Set parADOUserId = New ADODB.Parameter

> adParamInput, 72, Trim$(strUserId))
>         cmdADO.Parameters.Append parADOUserId

>         With cmdADO
>             .Execute
>         End With

>         Set parADOUserId = Nothing
>         Set cmdADO = Nothing

> Tx,
> Kurt



Wed, 04 Feb 2004 02:38:59 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing a adGuid parameters to a SP...

2. pass parameter to SQL SP from VB and return recordset

3. Passing parameters to IF-Statement SP

4. Problem passing the default parameters in sp

5. Passing Parameters to IF-Statement SP

6. Don't pass a parameter to SP

7. Trouble with SP output parameter

8. I can't call Oracle SP from VB5 with over 10 parameters

9. Active X control for collecting SP parameters

10. SP Parameters

11. Performing query past trough a parameter in a SP

12. Creating a table via SP where the table name is a parameter

 

 
Powered by phpBB® Forum Software