Sunday, February 19, 2012

How to use "N" syntax for unicode parameters

Hi all,

I had two Nvarchar(255) columns & retreive it like this

DIM CN1 AS SQLCONNECTION
DIM DR1 AS SQLDATAADAPTER
DIM DTABLE AS DATATABLE
DIM DTSET AS DATASET

DTSET=NEW DATASET()
DR1=NEW SQLDATAADAPTER("SP_PRO1",CN1)
DR1.SELECTCOMMAND.COMMANDTYPE=COMMANDTYPE.STOREDPROCEDURE
DR1.SELECTCOMMAND.PARAMETERS.ADD("@.TYPE1", REQUEST.QUERYSTRING("PID"))
DR1.SELECTCOMMAND.PARAMETERS.ADD("@.TYPE1", REQUEST.QUERYSTRING("UID"))
DR1.FILL(DTSET,CINT(INTCURRINDEX.TEXT),CINT (INTPAGESIZE.TEXT),"SP_PRO1")
DL1.DATASOURCE=DTSET.TABLES(0).DEFAULTVIEW
DL1.DATABIND()
CN1.CLOSE()
END SUB

How to insert "N" National Code to parameter? I try it N"@.TYPE1" or "N@.TYPE1" with failed. Any ideas or advise? Thanks a lot.

Arisnot used to reading everything in caps.. feels like someone screaming..
anyway, do you want to add the character 'N" to the value of the parameter?

if so, try

.Add("@.Type1", "N" & Request.Querystring("PID"))

now in the code I see that there are TWO @.Type1 params.. it's probably a typo.|||You shouldn't need to, .net only uses Unicode.

No comments:

Post a Comment