Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert into nText field on SQL Server

LEGEND ,
Sep 14, 2007 Sep 14, 2007
Hi,

I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a field
into an 'ntext' type field in SQL Server 2000. I get the following error :
Application uses a value of the wrong type for the current operation.

I know this refers to the following line in which I have the wrong parameter
type :

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1,
4000, Request.Form("Answer"))

However, parameter 201 is a long string value and it's been given a maximum
length of 4000. How can I change this so it will be complatible with a
'text' format in SQL Server?


TOPICS
Server side applications
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
"Mintyman" <mintyman@ntlworld.com> wrote in message
news:fcdp8m$cfb$1@forums.macromedia.com...
> Hi,
>
> I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a
> field into an 'ntext' type field in SQL Server 2000. I get the following
> error :
> Application uses a value of the wrong type for the current operation.
>
> I know this refers to the following line in which I have the wrong
> parameter type :
>
> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1,
> 4000, Request.Form("Answer"))
>
> However, parameter 201 is a long string value and it's been given a
> maximum length of 4000. How can I change this so it will be complatible
> with a 'text' format in SQL Server?
>

I think you need to use the adVarWChar (202) Null-terminated Unicode
character string parameter type
http://msdn2.microsoft.com/en-us/library/ms675318.aspx

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
Hi Joris,

Do you have any idea what value I put for the length?

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
???, Request.Form("Answer"))

Minty



"Joris van Lier" <whizzrd@hotmail.com> wrote in message
news:fcdphk$cpa$1@forums.macromedia.com...
> "Mintyman" <mintyman@ntlworld.com> wrote in message
> news:fcdp8m$cfb$1@forums.macromedia.com...
>> Hi,
>>
>> I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a
>> field into an 'ntext' type field in SQL Server 2000. I get the following
>> error :
>> Application uses a value of the wrong type for the current operation.
>>
>> I know this refers to the following line in which I have the wrong
>> parameter type :
>>
>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1,
>> 4000, Request.Form("Answer"))
>>
>> However, parameter 201 is a long string value and it's been given a
>> maximum length of 4000. How can I change this so it will be complatible
>> with a 'text' format in SQL Server?
>>
>
> I think you need to use the adVarWChar (202) Null-terminated Unicode
> character string parameter type
> http://msdn2.microsoft.com/en-us/library/ms675318.aspx


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
I tried changing it to :

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
10000000, MM_IIF(Request.Form("Answer"), Request.Form("Answer"), null))

but i'm getting a new error now :

[Microsoft][ODBC SQL Server Driver]String data, right truncation

Any ideas?


"Joris van Lier" <whizzrd@hotmail.com> wrote in message
news:fcdphk$cpa$1@forums.macromedia.com...
> "Mintyman" <mintyman@ntlworld.com> wrote in message
> news:fcdp8m$cfb$1@forums.macromedia.com...
>> Hi,
>>
>> I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a
>> field into an 'ntext' type field in SQL Server 2000. I get the following
>> error :
>> Application uses a value of the wrong type for the current operation.
>>
>> I know this refers to the following line in which I have the wrong
>> parameter type :
>>
>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1,
>> 4000, Request.Form("Answer"))
>>
>> However, parameter 201 is a long string value and it's been given a
>> maximum length of 4000. How can I change this so it will be complatible
>> with a 'text' format in SQL Server?
>>
>
> I think you need to use the adVarWChar (202) Null-terminated Unicode
> character string parameter type
> http://msdn2.microsoft.com/en-us/library/ms675318.aspx


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
>> "Mintyman" <mintyman@ntlworld.com> wrote in message
>> news:fcdp8m$cfb$1@forums.macromedia.com...
>>> Hi,
>>>
>>> I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a
>>> field into an 'ntext' type field in SQL Server 2000. I get the following
>>> error :
>>> Application uses a value of the wrong type for the current operation.
>>>
>>> I know this refers to the following line in which I have the wrong
>>> parameter type :
>>>
>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201,
>>> 1, 4000, Request.Form("Answer"))
>>>
>>> However, parameter 201 is a long string value and it's been given a
>>> maximum length of 4000. How can I change this so it will be complatible
>>> with a 'text' format in SQL Server?
>>>
>> "Joris van Lier" <whizzrd@hotmail.com> wrote in message
>> news:fcdphk$cpa$1@forums.macromedia.com...
>>
>> I think you need to use the adVarWChar (202) Null-terminated Unicode
>> character string parameter type
>> http://msdn2.microsoft.com/en-us/library/ms675318.aspx

"Mintyman" <mintyman@ntlworld.com> wrote in message
news:fcdpp4$cvm$1@forums.macromedia.com...
> Hi Joris,
>
> Do you have any idea what value I put for the length?
>
> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
> ???, Request.Form("Answer"))
>
> Minty


I think you can omit the size or assign it the actual size of the variable

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
Len(Request.Form("Answer")), Request.Form("Answer"))


Or

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, ,
Request.Form("Answer"))


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
Hi Joris,

I tried both of your suggestions. Neither of them worked.

When I tried defining the exact length I got the following error:

[Microsoft][ODBC SQL Server Driver]String data, right truncation

When I tried leaving the length blank, I got the following error:

Parameter object is improperly defined. Inconsistent or incomplete
information was provided.

Any ideas?


"Joris van Lier" <whizzrd@hotmail.com> wrote in message
news:fcdq4j$de2$1@forums.macromedia.com...
>>> "Mintyman" <mintyman@ntlworld.com> wrote in message
>>> news:fcdp8m$cfb$1@forums.macromedia.com...
>>>> Hi,
>>>>
>>>> I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a
>>>> field into an 'ntext' type field in SQL Server 2000. I get the
>>>> following error :
>>>> Application uses a value of the wrong type for the current operation.
>>>>
>>>> I know this refers to the following line in which I have the wrong
>>>> parameter type :
>>>>
>>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201,
>>>> 1, 4000, Request.Form("Answer"))
>>>>
>>>> However, parameter 201 is a long string value and it's been given a
>>>> maximum length of 4000. How can I change this so it will be complatible
>>>> with a 'text' format in SQL Server?
>>>>
>>> "Joris van Lier" <whizzrd@hotmail.com> wrote in message
>>> news:fcdphk$cpa$1@forums.macromedia.com...
>>>
>>> I think you need to use the adVarWChar (202) Null-terminated Unicode
>>> character string parameter type
>>> http://msdn2.microsoft.com/en-us/library/ms675318.aspx
>
> "Mintyman" <mintyman@ntlworld.com> wrote in message
> news:fcdpp4$cvm$1@forums.macromedia.com...
>> Hi Joris,
>>
>> Do you have any idea what value I put for the length?
>>
>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
>> ???, Request.Form("Answer"))
>>
>> Minty
>
>
> I think you can omit the size or assign it the actual size of the variable
>
> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
> Len(Request.Form("Answer")), Request.Form("Answer"))
>
>
> Or
>
> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
> , Request.Form("Answer"))
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
>>>> "Mintyman" <mintyman@ntlworld.com> wrote in message
>>>> news:fcdp8m$cfb$1@forums.macromedia.com...
>>>>> Hi,
>>>>>
>>>>> I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a
>>>>> field into an 'ntext' type field in SQL Server 2000. I get the
>>>>> following error :
>>>>> Application uses a value of the wrong type for the current operation.
>>>>>
>>>>> I know this refers to the following line in which I have the wrong
>>>>> parameter type :
>>>>>
>>>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201,
>>>>> 1, 4000, Request.Form("Answer"))
>>>>>
>>>>> However, parameter 201 is a long string value and it's been given a
>>>>> maximum length of 4000. How can I change this so it will be
>>>>> complatible with a 'text' format in SQL Server?
>>>>>
>>>> "Joris van Lier" <whizzrd@hotmail.com> wrote in message
>>>> news:fcdphk$cpa$1@forums.macromedia.com...
>>>>
>>>> I think you need to use the adVarWChar (202) Null-terminated Unicode
>>>> character string parameter type
>>>> http://msdn2.microsoft.com/en-us/library/ms675318.aspx
>>
>> "Mintyman" <mintyman@ntlworld.com> wrote in message
>> news:fcdpp4$cvm$1@forums.macromedia.com...
>>> Hi Joris,
>>>
>>> Do you have any idea what value I put for the length?
>>>
>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202,
>>> 1, ???, Request.Form("Answer"))
>>>
>>> Minty
>> "Joris van Lier" <whizzrd@hotmail.com> wrote in message
>> news:fcdq4j$de2$1@forums.macromedia.com...
>> I think you can omit the size or assign it the actual size of the
>> variable
>>
>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
>> Len(Request.Form("Answer")), Request.Form("Answer"))
>>
>>
>> Or
>>
>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1,
>> , Request.Form("Answer"))
"Mintyman" <mintyman@ntlworld.com> wrote in message
news:fcdqsg$e5e$1@forums.macromedia.com...
> Hi Joris,
>
> I tried both of your suggestions. Neither of them worked.
>
> When I tried defining the exact length I got the following error:
>
> [Microsoft][ODBC SQL Server Driver]String data, right truncation
>
> When I tried leaving the length blank, I got the following error:
>
> Parameter object is improperly defined. Inconsistent or incomplete
> information was provided.
>
> Any ideas?

I'll do some testing, you're using ASP/VBScript right?
What version of SQL Server 2000 are you using? is it the MSDE version of the
Full version?
What version of IIS are you using?
OS version?
And your table layout.

Right truncation errors indicate that the value is too large to fit in the
parameter or column.




Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
Joris,

I've cracked it. I tried using a different parameter type - 203. I set the
length to the maximum it could be :

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 203, 1,
1073741823, Request.Form("Answer")) ' adLongVarWChar

Hey presto, it works!

Thanks for all your help :o)


"Joris van Lier" <whizzrd@hotmail.com> wrote in message
news:fcdrd4$em8$1@forums.macromedia.com...
>>>>> "Mintyman" <mintyman@ntlworld.com> wrote in message
>>>>> news:fcdp8m$cfb$1@forums.macromedia.com...
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to use the 'insert' behaviour in Dreamweaver 8 to insert a
>>>>>> field into an 'ntext' type field in SQL Server 2000. I get the
>>>>>> following error :
>>>>>> Application uses a value of the wrong type for the current operation.
>>>>>>
>>>>>> I know this refers to the following line in which I have the wrong
>>>>>> parameter type :
>>>>>>
>>>>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4",
>>>>>> 201, 1, 4000, Request.Form("Answer"))
>>>>>>
>>>>>> However, parameter 201 is a long string value and it's been given a
>>>>>> maximum length of 4000. How can I change this so it will be
>>>>>> complatible with a 'text' format in SQL Server?
>>>>>>
>>>>> "Joris van Lier" <whizzrd@hotmail.com> wrote in message
>>>>> news:fcdphk$cpa$1@forums.macromedia.com...
>>>>>
>>>>> I think you need to use the adVarWChar (202) Null-terminated Unicode
>>>>> character string parameter type
>>>>> http://msdn2.microsoft.com/en-us/library/ms675318.aspx
>>>
>>> "Mintyman" <mintyman@ntlworld.com> wrote in message
>>> news:fcdpp4$cvm$1@forums.macromedia.com...
>>>> Hi Joris,
>>>>
>>>> Do you have any idea what value I put for the length?
>>>>
>>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202,
>>>> 1, ???, Request.Form("Answer"))
>>>>
>>>> Minty
>>> "Joris van Lier" <whizzrd@hotmail.com> wrote in message
>>> news:fcdq4j$de2$1@forums.macromedia.com...
>>> I think you can omit the size or assign it the actual size of the
>>> variable
>>>
>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202,
>>> 1, Len(Request.Form("Answer")), Request.Form("Answer"))
>>>
>>>
>>> Or
>>>
>>> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202,
>>> 1, , Request.Form("Answer"))
> "Mintyman" <mintyman@ntlworld.com> wrote in message
> news:fcdqsg$e5e$1@forums.macromedia.com...
>> Hi Joris,
>>
>> I tried both of your suggestions. Neither of them worked.
>>
>> When I tried defining the exact length I got the following error:
>>
>> [Microsoft][ODBC SQL Server Driver]String data, right truncation
>>
>> When I tried leaving the length blank, I got the following error:
>>
>> Parameter object is improperly defined. Inconsistent or incomplete
>> information was provided.
>>
>> Any ideas?
>
> I'll do some testing, you're using ASP/VBScript right?
> What version of SQL Server 2000 are you using? is it the MSDE version of
> the Full version?
> What version of IIS are you using?
> OS version?
> And your table layout.
>
> Right truncation errors indicate that the value is too large to fit in the
> parameter or column.
>
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2007 Sep 14, 2007
LATEST
"Mintyman" <mintyman@ntlworld.com> wrote in message
news:fcdrgn$eoj$1@forums.macromedia.com...
> Joris,
>
> I've cracked it. I tried using a different parameter type - 203. I set the
> length to the maximum it could be :
>
> MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 203, 1,
> 1073741823, Request.Form("Answer")) ' adLongVarWChar
>
> Hey presto, it works!
>
> Thanks for all your help :o)
>

Great, thanks for sharing the solution...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines