Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Posts
    454

    Question Unanswered: What is the ADO constant for text datatype?

    I have a table (MSSQL 2000 server) with a column called "Content" whose datatype is text. Now I'm trying to insert data into the table using a stored procedure. What is the ADO constant that I should use to insert value into that column? My pieces of code are

    Dim Conn, cmd
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.ConnectionString = Application("ConnStr")
    Conn.Open
    Conn.BeginTrans
    Conn.CursorLocation = adUseClientBatch
    Set cmd = Server.CreateObject("ADODB.Command")
    cmd.ActiveConnection = Conn
    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "MyStoredProcedure"

    cmd.Parameters.Append
    cmd.CreateParameter("content", adLongVarChar, adParamInput, 50000, content)
    cmd.Execute

    I got the following error message:
    Application uses a value of the wrong type for the current operation.

    What should I use to replace adLongVarChar? Thanks in advance.

  2. #2
    Join Date
    Dec 2003
    Posts
    7

    Text Data Type

    It depends on the text type.

    Char = 129
    Varchar = 200
    LongVarchar = 201

    There are others check the help file.
    Search for AdoEnums.DataType

    David

  3. #3
    Join Date
    Dec 2003
    Posts
    454

    Re: Text Data Type

    Originally posted by DavidGrimes
    It depends on the text type.

    Char = 129
    Varchar = 200
    LongVarchar = 201

    There are others check the help file.
    Search for AdoEnums.DataType

    David
    Datatype of this column is text.

  4. #4
    Join Date
    Dec 2003
    Posts
    454

    What is the ADO constant for text datatype?

    Hi David,

    The column data type is set to text since the number of the characters of data is more than 40000. I tried several ADO constants and it did not work. Do you have any idea about it? Thanks.

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Is it text or ntext ?

  6. #6
    Join Date
    Dec 2003
    Posts
    454

    It is text

    Originally posted by rnealejr
    Is it text or ntext ?
    It is text.

  7. #7
    Join Date
    Feb 2002
    Posts
    2,232
    That should work.

    Creat a recordset object - querying this same table and look in the recordset properties to see what datatype is associated with that column. This will tell you which datatype to use.

Posting Permissions

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