Jpresser
asked on
SQL 7 Text type
What is the corresponding ADO DatatypeEnum for SQL 7.0 Text type.
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"adLongVarchar" indicates a long string value (Parameter object only).
"adBSTR" indicates a null-terminated character string (Unicode)(DBTYPE_BSTR).
so, which one is right?
"adLongVarchar " or "adBSTR"?
:)
"adBSTR" indicates a null-terminated character string (Unicode)(DBTYPE_BSTR).
so, which one is right?
"adLongVarchar " or "adBSTR"?
:)
advarchar with a size of 2147483647
as in the following
cmd.CreateParameter("@answ er",adVarC har,adPara mInput,214 7483647,an swer)
as in the following
cmd.CreateParameter("@answ
ASKER
Here is the code I am testing the text data type with:
Dim objCommand2, strConnect
strConnect = "DSN=SALESSQL;initial catalog=Dole;UID=sa;PWD="
Set objCommand2= Server.CreateObject("ADODB .Command")
objCommand2.ActiveConnecti on = strConnect
objCommand2.CommandText = "aaatest"
objCommand2.CommandType = adCmdStoredProc
Set objParameter = objCommand2.CreateParamete r("@Col1", adChar,adP aramInput, 10,Request .Form("txt Char"))
objCommand2.Parameters.App end objParameter
Set objParameter = objCommand2.CreateParamete r("@Col2", adLongVarC har,adPara mInput,110 0,Request. Form("txtT ext"))
objCommand2.Parameters.App end objParameter
objCommand2.Execute
Response.Write Len(Request.Form("txtText" ))
The length of the string I was trying to insert into the table turned out to be 1100 characters long. The insert fails to go into the text field. of SQL Server 7.0 table.
Dim objCommand2, strConnect
strConnect = "DSN=SALESSQL;initial catalog=Dole;UID=sa;PWD="
Set objCommand2= Server.CreateObject("ADODB
objCommand2.ActiveConnecti
objCommand2.CommandText = "aaatest"
objCommand2.CommandType = adCmdStoredProc
Set objParameter = objCommand2.CreateParamete
objCommand2.Parameters.App
Set objParameter = objCommand2.CreateParamete
objCommand2.Parameters.App
objCommand2.Execute
Response.Write Len(Request.Form("txtText"
The length of the string I was trying to insert into the table turned out to be 1100 characters long. The insert fails to go into the text field. of SQL Server 7.0 table.
Jpresser,
the size of a parameter is dependant on the underlying datatype not the data you are passing to it. I have have successfully used the 'advarchar' datatype with size 2147483647 as stated above.
the size of a parameter is dependant on the underlying datatype not the data you are passing to it. I have have successfully used the 'advarchar' datatype with size 2147483647 as stated above.
ASKER
amnh:
I tried your example, it did not work with the text type in sql server. It works fine if I use a varchar as the data type.
When I try to insert 900 or more characters into the text type, nothing gets inserted into the field.
The example I left calls a simple stored procedure that just does an insert. For some reason it fails to work when the character string get to the 900 or so characters. It works however, if the data type is varchar, and fails if it is text.
I tried your example, it did not work with the text type in sql server. It works fine if I use a varchar as the data type.
When I try to insert 900 or more characters into the text type, nothing gets inserted into the field.
The example I left calls a simple stored procedure that just does an insert. For some reason it fails to work when the character string get to the 900 or so characters. It works however, if the data type is varchar, and fails if it is text.
Jpresser
It works fine for me with adVarchar and much more than 900 characters for a TEXT column in SQL Server
It works fine for me with adVarchar and much more than 900 characters for a TEXT column in SQL Server
Jpresser,
Have a text datatype for your text-field in the table.
But in your stored procedure, declare it as varchar(1100), like this
create procedure aaatest
...
@Col2 varchar(1100)
...
BTW, I myself haven't try to have a parameter with text type but it's still intriguing to know what exactly the type for text parameter (not using varchar parameter)
Have a text datatype for your text-field in the table.
But in your stored procedure, declare it as varchar(1100), like this
create procedure aaatest
...
@Col2 varchar(1100)
...
BTW, I myself haven't try to have a parameter with text type but it's still intriguing to know what exactly the type for text parameter (not using varchar parameter)
ASKER
The data in the text field could not be seen after it reached a certain length. It was, however, always there.
Thanks
Thanks
^@^
only guess