Quick Parameterized SQL question (inserting text)

  • Thread starter Thread starter darrel
  • Start date Start date
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
 
If you are using MSSQL, is there any reason you aren't using
System.Data.SqlClient (whose SqlDbType does has a Text value)

karl
 
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
 
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
 
Back
Top