Quick Parameterized SQL question (inserting text)

D

darrel

I'm using parameterized sql for my Db updates and typically use something
like this:

objCommand.Parameters.Add("@pageID",
System.Data.OleDb.OleDbType.numeric).Value = 24

However, I now need to add a string to a 'text' field in MsSQL. There isn't
a System.data.oledbtype.text option.

Is System.Data.OleDb.OleDbType.LongVarChar proper? Another option? BSTR?

-Darrel
 
K

Karl Seguin [MVP]

If you are using MSSQL, is there any reason you aren't using
System.Data.SqlClient (whose SqlDbType does has a Text value)

karl
 
D

Darrel

If you are using MSSQL, is there any reason you aren't using
System.Data.SqlClient (whose SqlDbType does has a Text value)

Not any pragmatic reason. It's just what's always been used here. Sounds
like this is a good as any excuse to switch over.

Still, it's a bit odd that OleDB doesn't have a text option. Does MySQL not
use Text fields?

-Darrel
 
K

Karl Seguin [MVP]

OleDb is meant to be somewhat agnostic of the underlying database - so it
can't accomodate each one. I think a LongVarChar or simply a VarChar might
be what you need.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top