473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

long string to sql db

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.
Nov 9 '07 #1
15 1643
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
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?

--
Tom Shelton

Nov 9 '07 #2


"cj" <cj@nospam.nospamwrote in message
news:On**************@TK2MSFTNGP03.phx.gbl...
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
Nov 9 '07 #3
cj


Tom Shelton wrote:
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
>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.
>
--
Tom Shelton
Nov 9 '07 #4
cj


Tom Shelton wrote:
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
>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.
>
--
Tom Shelton
Nov 9 '07 #5
cj


Tom Shelton wrote:
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
>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.
>
--
Tom Shelton
Nov 9 '07 #6
cj
Looks like I'll have to do some testing.

Mythran wrote:
>

"cj" <cj@nospam.nospamwrote in message
news:On**************@TK2MSFTNGP03.phx.gbl...
>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

Nov 9 '07 #7
On Nov 9, 10:33 am, "Mythran" <kip_pot...@hotmail.comwrote:
"cj" <c...@nospam.nospamwrote in message

news:On**************@TK2MSFTNGP03.phx.gbl...


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....
I believe char's upper limit is 8000 char.

--
Tom Shelton

Nov 9 '07 #8
On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
Tom Shelton wrote:
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
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

Nov 9 '07 #9
cj


Tom Shelton wrote:
On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
>Tom Shelton wrote:
>>On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
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.

Nov 9 '07 #10
cj


cj wrote:
>

Tom Shelton wrote:
>On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
>>Tom Shelton wrote:
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
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.
Nov 9 '07 #11
On Nov 9, 1:14 pm, cj <c...@nospam.nospamwrote:
cj wrote:
Tom Shelton wrote:
On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
Tom Shelton wrote:
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
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 Shelton

Nov 9 '07 #12
On Nov 9, 2:01 pm, Tom Shelton <tom_shel...@comcast.netwrote:
On Nov 9, 1:14 pm, cj <c...@nospam.nospamwrote:


cj wrote:
Tom Shelton wrote:
>On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
>>Tom Shelton wrote:
>>>On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
>>>>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).

--
Tom Shelton

Nov 9 '07 #13
cj


Tom Shelton wrote:
On Nov 9, 1:14 pm, cj <c...@nospam.nospamwrote:
>cj wrote:
>>Tom Shelton wrote:
On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
Tom Shelton wrote:
>On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
>>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 Shelton
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.
Nov 9 '07 #14
On Nov 9, 2:21 pm, cj <c...@nospam.nospamwrote:
Tom Shelton wrote:
On Nov 9, 1:14 pm, cj <c...@nospam.nospamwrote:
cj wrote:
>Tom Shelton wrote:
On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
Tom Shelton wrote:
On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
>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 Shelton

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.

--
Tom Shelton

Nov 9 '07 #15
cj


Tom Shelton wrote:
On Nov 9, 2:21 pm, cj <c...@nospam.nospamwrote:
>Tom Shelton wrote:
>>On Nov 9, 1:14 pm, cj <c...@nospam.nospamwrote:
cj wrote:
Tom Shelton wrote:
>On Nov 9, 11:22 am, cj <c...@nospam.nospamwrote:
>>Tom Shelton wrote:
>>>On Nov 9, 9:44 am, cj <c...@nospam.nospamwrote:
>>>>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").Val ue = RTcode
>>>>myRspSqlCommand.Parameters("@mDATA").Val ue = RTrespstr
>>>>myRspSqlCommand.Parameters("@mUID").Valu e = 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 Shelton
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.

--
Tom Shelton
Thanks for all your help.
Nov 12 '07 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Galina | last post by:
Hello I am going to copy a data from MS Access table into Oracle table. One of fields is memo type and data in this field range from 1 character to 551 long string. Do I need to create a field...
7
by: William Payne | last post by:
Hello, I have a variable of type unsigned long. It has a number of bits set (with set I mean they equal one). I need to determine those bits and their position and create new numbers from them. For...
2
by: Bryan Olson | last post by:
The current Python standard library provides two cryptographic hash functions: MD5 and SHA-1 . The authors of MD5 originally stated: It is conjectured that it is computationally infeasible to...
2
by: Seth | last post by:
Ok, here is my setup. I have a fully functioning HTTP Handler implemented. The handler is supposed to handle every single request that comes in to a particular virtual directory. Thus, in IIS, I...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
30
by: jeremygetsmail | last post by:
I've got an adp (Metrix.adp) with a reference to another adp (InteractSQL.adp). InteractSQL sits on a server, and is refered to by all of the clients (Metrix), which sit on the client machines...
0
by: Slawomir Nasiadka | last post by:
Hi, I'am new to this group so I would like to say "Hello" everyone and here is my problem: I'm writing a simple application (code is at the end of this message) witch would list all mails...
3
by: tutush | last post by:
Hi there, I have problem with importing my C++ code to C#. The c++ looks like these extern _declspec(dllexport) const char* SendAndReceiveBufferedWrp(__int64 hConnection, const char*...
28
by: silvia.fama | last post by:
Hi! I'm using c language. I need to copy a long type value into a char string using a memcpy function: memcpy(string, (long *) value, len) this value will be then insert into a database. On...
2
by: PengYu.UT | last post by:
Hi, In python, triple quote (""") can be used to quote a paragraph (multiple lines). I'm wondering if there is any equivalent in C++. For the following code, I could write the long string in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.