Text fields in SQL Server and VS 2003 (ADO.net)

  • Thread starter Thread starter Woody Splawn
  • Start date Start date
W

Woody Splawn

I see that working with text fields (BLOBS) in SQL Server 2000 and ADO.net
is not as straight forward as what I am used to. I would like to understand
it though and make use of text fields.

Lets say I have a table called ConComments. In it I have two fields, a Char
field called ConNum with a length of 5, and a comments field that is a SQL
Server 2000 Text field. The ConNum field is the primary key for the table
and the table only has these two fields.

I would like to be able to make used of the comments field and put as many
comments in it as I like using a VS (VB) winform. But I see that this field
can not treated in the same same way other fields in a SQL table are.
Fields like VarChar or Char fields. I have noticed, for example, that when
I create a DataAdapter in a winform in VS 2003 that if I include the
Comments (text) field in the query select, I can not automatically create an
update statment. So.... What am I to do?

What do I need to do specifically to read and write data to the comments
field of the table mentioned above using VS 2003 and a winform?

Thank You.
 
Woody said:
I see that working with text fields (BLOBS) in SQL Server 2000 and ADO.net
is not as straight forward as what I am used to. I would like to understand
it though and make use of text fields.

Text fields are CLOBs ;) Image fields are BLOBs. Significant issue if you're
going to port data from/to different databases :).
Lets say I have a table called ConComments. In it I have two fields, a Char
field called ConNum with a length of 5, and a comments field that is a SQL
Server 2000 Text field. The ConNum field is the primary key for the table
and the table only has these two fields.

I would like to be able to make used of the comments field and put as many
comments in it as I like using a VS (VB) winform. But I see that this field
can not treated in the same same way other fields in a SQL table are.
Fields like VarChar or Char fields. I have noticed, for example, that when
I create a DataAdapter in a winform in VS 2003 that if I include the
Comments (text) field in the query select, I can not automatically create an
update statment. So.... What am I to do?

I'm not sure what you're trying to do, but it's perfectly possible to update
a text field using parameters in a query:

UPDATE ConComments
SET Comments = @comments
WHERE ConNum = @ConNum

and set this query as the update command, using SqlCommand objects, 2
parameters (one of type text, other of type char).

You tried this and it gave an error? If so, which one?
What do I need to do specifically to read and write data to the comments
field of the table mentioned above using VS 2003 and a winform?

Just as you would normally do with any other field, like an int field. Text
fields can be threated like you're updating a varchar field for example.
Perhaps it's wise to post some code you've tried and the errors you got so we
know what you did.

Frans.
 
Hi Woody,

I have an almost same simple database as you describe, I called it my
Herfried K. Wagner database I keep all my snippets and links in it.

It looks the same as you describe, I use the commandbuilder with it, and it
works fine.

The only thing special with the update I know from a Blob file (I do not
know if it is the same as a text file) is that there is no concurrency
checking on that.

Therefore, when somebody else has updated it before you, it will be done
again, however that is the only special thing I know.

Therefore, I am curious what can be the problem.

Cor
 
Back
Top