long string to sql db

C

cj

I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?

relevant bits of my VB2005 code:

mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure

myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))

..
..
..

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()


The stored procedure (which I didn't write)

-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

GO

the database structure is table structure shows data as being type char
and 1000 in length.
 
T

Tom Shelton

I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?

relevant bits of my VB2005 code:

mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure

myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))

.
.
.

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()

The stored procedure (which I didn't write)

-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

GO

the database structure is table structure shows data as being type char
and 1000 in length.

Have you checked the string your assigning to mData field? Is it
really greater then 258 chars? It doesn't contain non ansi chars?
 
M

Mythran

cj said:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?

relevant bits of my VB2005 code:

mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure

myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New SqlClient.SqlParameter("@mUID",
Data.SqlDbType.Char, 6))

.
.
.

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()


The stored procedure (which I didn't write)

-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA char(1000),@mUID
char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

GO

the database structure is table structure shows data as being type char
and 1000 in length.

Not sure, but char may have an upper limit on the number of characters it
will hold in a single field....

You may just want to use varchar or nvarchar and set that to 1000. That
will mean 1000 characters will fit into the field, but the actual size will
vary depending on the number of characters actually input into the field.

HTH,
Mythran
 
C

cj

Tom said:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?

relevant bits of my VB2005 code:

mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure

myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))

.
.
.

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()

The stored procedure (which I didn't write)

-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

GO

the database structure is table structure shows data as being type char
and 1000 in length.

Have you checked the string your assigning to mData field?

yes, of course

Is it
really greater then 258 chars? It doesn't contain non ansi chars?

good question but no it doesn't.
 
C

cj

Tom said:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?

relevant bits of my VB2005 code:

mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure

myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))

.
.
.

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()

The stored procedure (which I didn't write)

-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

GO

the database structure is table structure shows data as being type char
and 1000 in length.

Have you checked the string your assigning to mData field?

yes, of course

Is it
really greater then 258 chars? It doesn't contain non ansi chars?

good question but no it doesn't.
 
C

cj

Tom said:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?

relevant bits of my VB2005 code:

mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure

myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))

.
.
.

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()

The stored procedure (which I didn't write)

-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

GO

the database structure is table structure shows data as being type char
and 1000 in length.

Have you checked the string your assigning to mData field?

yes, of course

Is it
really greater then 258 chars? It doesn't contain non ansi chars?

good question but no it doesn't.
 
C

cj

Looks like I'll have to do some testing.
cj said:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?

relevant bits of my VB2005 code:

mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure

myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))

.
.
.

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()


The stored procedure (which I didn't write)

-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

GO

the database structure is table structure shows data as being type
char and 1000 in length.

Not sure, but char may have an upper limit on the number of characters
it will hold in a single field....

You may just want to use varchar or nvarchar and set that to 1000. That
will mean 1000 characters will fit into the field, but the actual size
will vary depending on the number of characters actually input into the
field.

HTH,
Mythran
 
T

Tom Shelton

I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New SqlClient.SqlParameter("@mUID",
Data.SqlDbType.Char, 6))

myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA char(1000),@mUID
char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )

the database structure is table structure shows data as being type char
and 1000 in length.

Not sure, but char may have an upper limit on the number of characters it
will hold in a single field....

I believe char's upper limit is 8000 char.
 
T

Tom Shelton

Tom said:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type char
and 1000 in length.
Have you checked the string your assigning to mData field?

yes, of course

Is it
really greater then 258 chars? It doesn't contain non ansi chars?

good question but no it doesn't.


Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)

Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
 
C

cj

Tom said:
Tom said:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type char
and 1000 in length.
Have you checked the string your assigning to mData field?
yes, of course

Is it
really greater then 258 chars? It doesn't contain non ansi chars?
good question but no it doesn't.


Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)

Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
no offense taken. I just wrote a test prg that does exactly what I have
above with RTrespstr = 999 "x"s which I had to figure out how to do in .net

Dim resp As New String("x"c, 999)

My next test will be in a VB 2003 program because I feel sure we tested
this and would have caught it wasn't working when it was first written
about 2 years ago in VB 2003. The program was updated to 2005 maybe a
year ago now but I sure didn't check every nook and cranny again. It
seemed to run and the normally used functionality was as expected. Now
we finally need to see this data field and I find it isn't complete.
Drat these computers, they are so naughty and so complex.
 
C

cj

cj said:
Tom said:
Tom Shelton wrote:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type
char
and 1000 in length.
Have you checked the string your assigning to mData field?
yes, of course

Is it

really greater then 258 chars? It doesn't contain non ansi chars?
good question but no it doesn't.


Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)

Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
no offense taken. I just wrote a test prg that does exactly what I have
above with RTrespstr = 999 "x"s which I had to figure out how to do in .net

Dim resp As New String("x"c, 999)

My next test will be in a VB 2003 program because I feel sure we tested
this and would have caught it wasn't working when it was first written
about 2 years ago in VB 2003. The program was updated to 2005 maybe a
year ago now but I sure didn't check every nook and cranny again. It
seemed to run and the normally used functionality was as expected. Now
we finally need to see this data field and I find it isn't complete.
Drat these computers, they are so naughty and so complex.
Well, apparently we glossed over that back when it was initally tested
too! VB 2003 also only stores 258 chars.

Oh and you asked what our DB was. It's SQL Server 2000.
 
T

Tom Shelton

cj said:
Tom said:
Tom Shelton wrote:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type
char
and 1000 in length.
Have you checked the string your assigning to mData field?
yes, of course
Is it
really greater then 258 chars? It doesn't contain non ansi chars?
good question but no it doesn't.
Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)
Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
no offense taken. I just wrote a test prg that does exactly what I have
above with RTrespstr = 999 "x"s which I had to figure out how to do in .net
Dim resp As New String("x"c, 999)
My next test will be in a VB 2003 program because I feel sure we tested
this and would have caught it wasn't working when it was first written
about 2 years ago in VB 2003. The program was updated to 2005 maybe a
year ago now but I sure didn't check every nook and cranny again. It
seemed to run and the normally used functionality was as expected. Now
we finally need to see this data field and I find it isn't complete.
Drat these computers, they are so naughty and so complex.

Well, apparently we glossed over that back when it was initally tested
too! VB 2003 also only stores 258 chars.

Oh and you asked what our DB was. It's SQL Server 2000.- Hide quoted text -

- Show quoted text -

Ok. Well the char datatype in sqlserver (2000 and 2005) has a max
length of 8000 chars. So, you should be ok there. My question now is
about the stored proc - is all it does insert the data? I mean, it
doesn't do anything else with it - it's just a simple insert?

I'm going to do a little test here and see if i can duplicate....
 
C

cj

Tom said:
cj said:
Tom Shelton wrote:
Tom Shelton wrote:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type
char
and 1000 in length.
Have you checked the string your assigning to mData field?
yes, of course
Is it
really greater then 258 chars? It doesn't contain non ansi chars?
good question but no it doesn't.
Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)
Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
--
Tom Shelton
no offense taken. I just wrote a test prg that does exactly what I have
above with RTrespstr = 999 "x"s which I had to figure out how to do in .net
Dim resp As New String("x"c, 999)
My next test will be in a VB 2003 program because I feel sure we tested
this and would have caught it wasn't working when it was first written
about 2 years ago in VB 2003. The program was updated to 2005 maybe a
year ago now but I sure didn't check every nook and cranny again. It
seemed to run and the normally used functionality was as expected. Now
we finally need to see this data field and I find it isn't complete.
Drat these computers, they are so naughty and so complex.
Well, apparently we glossed over that back when it was initally tested
too! VB 2003 also only stores 258 chars.

Oh and you asked what our DB was. It's SQL Server 2000.- Hide quoted text -

- Show quoted text -

Ok. Well the char datatype in sqlserver (2000 and 2005) has a max
length of 8000 chars. So, you should be ok there. My question now is
about the stored proc - is all it does insert the data? I mean, it
doesn't do anything else with it - it's just a simple insert?

I'm going to do a little test here and see if i can duplicate....

Tom, a fellow here figured it out. It is storing the data. Enterprise
Manager and SQL Query Analyzer have some issues with displaying a field
or variable over 258 chars. If you ask it to display a substring from
say 900 for 100 it will display the data. So it is adding the data but
viewing it using MS' tools might not be that easy.
 
T

Tom Shelton

cj wrote:
Tom Shelton wrote:
Tom Shelton wrote:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type
char
and 1000 in length.
Have you checked the string your assigning to mData field?
yes, of course
Is it
really greater then 258 chars? It doesn't contain non ansi chars?
good question but no it doesn't.
Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)
Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
--
Tom Shelton
no offense taken. I just wrote a test prg that does exactly what I have
above with RTrespstr = 999 "x"s which I had to figure out how to do in .net
Dim resp As New String("x"c, 999)
My next test will be in a VB 2003 program because I feel sure we tested
this and would have caught it wasn't working when it was first written
about 2 years ago in VB 2003. The program was updated to 2005 maybe a
year ago now but I sure didn't check every nook and cranny again. It
seemed to run and the normally used functionality was as expected. Now
we finally need to see this data field and I find it isn't complete.
Drat these computers, they are so naughty and so complex.
Well, apparently we glossed over that back when it was initally tested
too! VB 2003 also only stores 258 chars.
Oh and you asked what our DB was. It's SQL Server 2000.- Hide quoted text -
- Show quoted text -

Ok. Well the char datatype in sqlserver (2000 and 2005) has a max
length of 8000 chars. So, you should be ok there. My question now is
about the stored proc - is all it does insert the data? I mean, it
doesn't do anything else with it - it's just a simple insert?

I'm going to do a little test here and see if i can duplicate....

Well, i can't duplicate it... I created a char field of 1000 chars,
and a stored proc to insert it. I call it with a 1000 char string,
and sure enough that's what's inserted. (db is sqlserver 2005).
 
T

Tom Shelton

Tom said:
cj wrote:
Tom Shelton wrote:
Tom Shelton wrote:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type
char
and 1000 in length.
Have you checked the string your assigning to mData field?
yes, of course
Is it
really greater then 258 chars? It doesn't contain non ansi chars?
good question but no it doesn't.
Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)
Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
--
Tom Shelton
no offense taken. I just wrote a test prg that does exactly what I have
above with RTrespstr = 999 "x"s which I had to figure out how to do in .net
Dim resp As New String("x"c, 999)
My next test will be in a VB 2003 program because I feel sure we tested
this and would have caught it wasn't working when it was first written
about 2 years ago in VB 2003. The program was updated to 2005 maybe a
year ago now but I sure didn't check every nook and cranny again. It
seemed to run and the normally used functionality was as expected. Now
we finally need to see this data field and I find it isn't complete.
Drat these computers, they are so naughty and so complex.
Well, apparently we glossed over that back when it was initally tested
too! VB 2003 also only stores 258 chars.
Oh and you asked what our DB was. It's SQL Server 2000.- Hide quoted text -
- Show quoted text -
Ok. Well the char datatype in sqlserver (2000 and 2005) has a max
length of 8000 chars. So, you should be ok there. My question now is
about the stored proc - is all it does insert the data? I mean, it
doesn't do anything else with it - it's just a simple insert?
I'm going to do a little test here and see if i can duplicate....

Tom, a fellow here figured it out. It is storing the data. Enterprise
Manager and SQL Query Analyzer have some issues with displaying a field
or variable over 258 chars. If you ask it to display a substring from
say 900 for 100 it will display the data. So it is adding the data but
viewing it using MS' tools might not be that easy.- Hide quoted text -

- Show quoted text -

interesting.... i don't see that behavior on 2005, they must have
fixed it :) i'm glad you got it sorted out though.
 
C

cj

Tom said:
Tom said:
cj wrote:
Tom Shelton wrote:
Tom Shelton wrote:
I've got a long string to be written to a field in a sql db table via
stored procedure. For some reason I find only 258 chars are being
written. Any ideas?
relevant bits of my VB2005 code:
mySqlConnection.ConnectionString = "..........
mySqlCommand.Connection = mySqlConnection
mySqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.Connection = mySqlConnection
myRspSqlCommand.CommandType = CommandType.StoredProcedure
myRspSqlCommand.CommandText = "write_resp"
myRspSqlCommand.Parameters.Clear()
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mCODE", Data.SqlDbType.Char, 3))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mDATA", Data.SqlDbType.Char, 1000))
myRspSqlCommand.Parameters.Add(New
SqlClient.SqlParameter("@mUID", Data.SqlDbType.Char, 6))
.
.
.
myRspSqlCommand.Parameters("@mCODE").Value = RTcode
myRspSqlCommand.Parameters("@mDATA").Value = RTrespstr
myRspSqlCommand.Parameters("@mUID").Value = RTuid
myRspSqlCommand.ExecuteNonQuery()
The stored procedure (which I didn't write)
-- Parameters CODE,DATA,UID
CREATE PROCEDURE [dbo].[write_resp] @mCODE char(3),@mDATA
char(1000),@mUID char(6) AS
set nocount on
insert into vresp (code,data,uid) values(@mCODE,@mDATA,@mUID )
GO
the database structure is table structure shows data as being type
char
and 1000 in length.
Have you checked the string your assigning to mData field?
yes, of course
Is it
really greater then 258 chars? It doesn't contain non ansi chars?
good question but no it doesn't.
Ok, so we know the string contains valid data, and that it is longer
then 258 chars. By, the way - I wasn't trying to be insulting by
asking - I just wanted to make sure. Sometimes when we are in the
middle of a difficult problem, we sometimes miss the obvious :)
Is this sqlserver? What version? I'm assuming it is - but, I wanted
to make sure. Can you give us an example of the string your trying to
pass (one that won't violate any proprietary information, of course).
--
Tom Shelton
no offense taken. I just wrote a test prg that does exactly what I have
above with RTrespstr = 999 "x"s which I had to figure out how to do in .net
Dim resp As New String("x"c, 999)
My next test will be in a VB 2003 program because I feel sure we tested
this and would have caught it wasn't working when it was first written
about 2 years ago in VB 2003. The program was updated to 2005 maybe a
year ago now but I sure didn't check every nook and cranny again. It
seemed to run and the normally used functionality was as expected. Now
we finally need to see this data field and I find it isn't complete.
Drat these computers, they are so naughty and so complex.
Well, apparently we glossed over that back when it was initally tested
too! VB 2003 also only stores 258 chars.
Oh and you asked what our DB was. It's SQL Server 2000.- Hide quoted text -
- Show quoted text -
Ok. Well the char datatype in sqlserver (2000 and 2005) has a max
length of 8000 chars. So, you should be ok there. My question now is
about the stored proc - is all it does insert the data? I mean, it
doesn't do anything else with it - it's just a simple insert?
I'm going to do a little test here and see if i can duplicate....
Tom, a fellow here figured it out. It is storing the data. Enterprise
Manager and SQL Query Analyzer have some issues with displaying a field
or variable over 258 chars. If you ask it to display a substring from
say 900 for 100 it will display the data. So it is adding the data but
viewing it using MS' tools might not be that easy.- Hide quoted text -

- Show quoted text -

interesting.... i don't see that behavior on 2005, they must have
fixed it :) i'm glad you got it sorted out though.
Thanks for all your help.
 
Top