Interesting question~

Discussion in 'ASP General' started by ºa¤Ö@¤½¥q, Aug 9, 2005.

  1. I find a interesting question, and I cannot solve it
    @.@

    If i want to insert unicode data, I need using recordset.addnew instead of
    using "insert into table" query or "stored procedure"

    All unicode data inserted into database through insert query or stored
    procedure would become a question mark "?" no matter:
    1. the field is nvarchar
    2. the collpase is SQL_Latin_General_CP1_XX_XX" or
    "SQL_Latin_General_CP850_XX_XX"
    3. the @codepage=65001
    4. the charset of html page set to utf-8
    5. or both above solution

    That means i cannot hide my database structure by using stored procedure, i
    need place ALL code inside asp and the asp become very heavy....

    Any solution?

    Thanks
    ºa¤Ö@¤½¥q, Aug 9, 2005
    #1
    1. Advertising

  2. This is not true. Did you prefix the string with the N character?

    CREATE PROCEDURE dbo.foo
    @param NVARCHAR(255)
    AS
    BEGIN
    SET NOCOUNT ON
    INSERT table(column) SELECT @param
    END
    GO

    Then from ASP:

    conn.execute "EXEC dbo.foo @param = N'bar'",,129

    This works for me just fine.





    "ºa¤Ö@¤½¥q" <ºa¤Ö@¾ã»æ.¨p¤H¤½¥q> wrote in message
    news:%...
    >I find a interesting question, and I cannot solve it
    > @.@
    >
    > If i want to insert unicode data, I need using recordset.addnew instead of
    > using "insert into table" query or "stored procedure"
    >
    > All unicode data inserted into database through insert query or stored
    > procedure would become a question mark "?" no matter:
    > 1. the field is nvarchar
    > 2. the collpase is SQL_Latin_General_CP1_XX_XX" or
    > "SQL_Latin_General_CP850_XX_XX"
    > 3. the @codepage=65001
    > 4. the charset of html page set to utf-8
    > 5. or both above solution
    >
    > That means i cannot hide my database structure by using stored procedure,
    > i
    > need place ALL code inside asp and the asp become very heavy....
    >
    > Any solution?
    >
    > Thanks
    >
    >
    Aaron Bertrand [SQL Server MVP], Aug 9, 2005
    #2
    1. Advertising

  3. ºa¤Ö@¤½¥q

    Mark Schupp Guest

    What DBMS?

    --
    --Mark Schupp


    "ºa¤Ö@¤½¥q" <ºa¤Ö@¾ã»æ.¨p¤H¤½¥q> wrote in message
    news:%...
    >I find a interesting question, and I cannot solve it
    > @.@
    >
    > If i want to insert unicode data, I need using recordset.addnew instead of
    > using "insert into table" query or "stored procedure"
    >
    > All unicode data inserted into database through insert query or stored
    > procedure would become a question mark "?" no matter:
    > 1. the field is nvarchar
    > 2. the collpase is SQL_Latin_General_CP1_XX_XX" or
    > "SQL_Latin_General_CP850_XX_XX"
    > 3. the @codepage=65001
    > 4. the charset of html page set to utf-8
    > 5. or both above solution
    >
    > That means i cannot hide my database structure by using stored procedure,
    > i
    > need place ALL code inside asp and the asp become very heavy....
    >
    > Any solution?
    >
    > Thanks
    >
    >
    Mark Schupp, Aug 9, 2005
    #3
  4. yes~
    I missed to mention it
    I tried this way already

    but still become question mark "?"
    ^.^

    "Aaron Bertrand [SQL Server MVP]" <> wrote in message
    news:...
    > This is not true. Did you prefix the string with the N character?
    >
    > CREATE PROCEDURE dbo.foo
    > @param NVARCHAR(255)
    > AS
    > BEGIN
    > SET NOCOUNT ON
    > INSERT table(column) SELECT @param
    > END
    > GO
    >
    > Then from ASP:
    >
    > conn.execute "EXEC dbo.foo @param = N'bar'",,129
    >
    > This works for me just fine.
    >
    >
    >
    >
    >
    > "ºa¤Ö@¤½¥q" <ºa¤Ö@¾ã»æ.¨p¤H¤½¥q> wrote in message
    > news:%...
    > >I find a interesting question, and I cannot solve it
    > > @.@
    > >
    > > If i want to insert unicode data, I need using recordset.addnew instead

    of
    > > using "insert into table" query or "stored procedure"
    > >
    > > All unicode data inserted into database through insert query or stored
    > > procedure would become a question mark "?" no matter:
    > > 1. the field is nvarchar
    > > 2. the collpase is SQL_Latin_General_CP1_XX_XX" or
    > > "SQL_Latin_General_CP850_XX_XX"
    > > 3. the @codepage=65001
    > > 4. the charset of html page set to utf-8
    > > 5. or both above solution
    > >
    > > That means i cannot hide my database structure by using stored

    procedure,
    > > i
    > > need place ALL code inside asp and the asp become very heavy....
    > >
    > > Any solution?
    > >
    > > Thanks
    > >
    > >

    >
    >
    ºa¤Ö@¤½¥q, Aug 9, 2005
    #4
  5. I am using MS SQL2000 standard edition
    ^.^

    "Mark Schupp" <> wrote in message
    news:...
    > What DBMS?
    >
    > --
    > --Mark Schupp
    >
    >
    > "ºa¤Ö@¤½¥q" <ºa¤Ö@¾ã»æ.¨p¤H¤½¥q> wrote in message
    > news:%...
    > >I find a interesting question, and I cannot solve it
    > > @.@
    > >
    > > If i want to insert unicode data, I need using recordset.addnew instead

    of
    > > using "insert into table" query or "stored procedure"
    > >
    > > All unicode data inserted into database through insert query or stored
    > > procedure would become a question mark "?" no matter:
    > > 1. the field is nvarchar
    > > 2. the collpase is SQL_Latin_General_CP1_XX_XX" or
    > > "SQL_Latin_General_CP850_XX_XX"
    > > 3. the @codepage=65001
    > > 4. the charset of html page set to utf-8
    > > 5. or both above solution
    > >
    > > That means i cannot hide my database structure by using stored

    procedure,
    > > i
    > > need place ALL code inside asp and the asp become very heavy....
    > >
    > > Any solution?
    > >
    > > Thanks
    > >
    > >

    >
    >
    ºa¤Ö@¤½¥q, Aug 9, 2005
    #5
  6. This one I tried with error occurred
    Example:
    table: customer
    field: name_tc nvarchar(10)

    and I used command object to create parameter object and append to
    adodb.command
    and the type should be
    set param = createParameter("@NameTc", adVarWChar, adInputParam, 10,
    variable_of_name)

    but dont know why the server prompt something like the length of data I
    provided is longer than the field's length....

    Let me try again
    ^.^

    "Dave Anderson" <> wrote in message
    news:...
    > ºa¤Ö@¤½¥q wrote:
    > > If i want to insert unicode data, I need using
    > > recordset.addnew instead of using "insert into
    > > table" query or "stored procedure"

    >
    > Not if you use an ADODB.Command object:
    > http://msdn.microsoft.com/library/en-us/ado270/htm/mdobjcommand.asp
    >
    > Extending Aaron's example (but with server-side JScript):
    >
    > var CMD = Server.CreateObject("ADODB.Command")
    >
    > CMD.ActiveConnection = { your open connection object }
    > CMD.CommandType = adCmdStoredProc
    > CMD.CommandText = "foo"
    >
    > CMD.Parameters.Append(
    > CMD.CreateParameter(
    > "@Param",adVarWChar,adParamInput,255,YourValue
    > )
    > )
    > CMD.Execute()
    >
    >
    > CommandTypeEnum:
    >

    http://msdn.microsoft.com/library/en-us/ado270/htm/mdcstcommandtypeenum.asp
    > DataTypeEnum:
    > http://msdn.microsoft.com/library/en-us/ado270/htm/mdcstdatatypeenum.asp
    > ParameterDirectionEnum:
    >

    http://msdn.microsoft.com/library/en-us/ado270/htm/mdcstparameterdirectionenum.asp
    >
    >
    >
    > --
    > Dave Anderson
    >
    > Unsolicited commercial email will be read at a cost of $500 per message.

    Use
    > of this email address implies consent to these terms. Please do not

    contact
    > me directly or ask me to contact you directly for assistance. If your
    > question is worth asking, it's worth posting.
    >
    >
    ºa¤Ö@¤½¥q, Aug 9, 2005
    #6
  7. > but still become question mark "?"

    How have you verified that this is what is STORED? It sounds like this is
    what you see when you display it on your web page, but I am not convinced
    that what is in the database is ?
    Aaron Bertrand [SQL Server MVP], Aug 9, 2005
    #7
  8. Yes
    I using MSSQL 2000 Enterprise Manager and query the database data
    and it stored question mark as well
    ^.^

    "Aaron Bertrand [SQL Server MVP]" <> wrote in message
    news:%...
    > > but still become question mark "?"

    >
    > How have you verified that this is what is STORED? It sounds like this is
    > what you see when you display it on your web page, but I am not convinced
    > that what is in the database is ?
    >
    >
    ºa¤Ö@¤½¥q, Aug 10, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jay
    Replies:
    1
    Views:
    357
    Chris Taylor
    Oct 2, 2003
  2. =?ISO-8859-1?Q?Andreas_R=F8sdal?=

    Interesting Casting question

    =?ISO-8859-1?Q?Andreas_R=F8sdal?=, Mar 3, 2004, in forum: Java
    Replies:
    3
    Views:
    340
    Tony Morris
    Mar 3, 2004
  3. Christian Bongiorno
    Replies:
    2
    Views:
    349
    Fahd Shariff
    May 10, 2004
  4. Replies:
    6
    Views:
    394
    Ian T
    Dec 10, 2004
  5. Fran Cotton

    Very Interesting XSL Question

    Fran Cotton, Aug 5, 2003, in forum: XML
    Replies:
    3
    Views:
    446
    Erhard Schwenk
    Aug 5, 2003
Loading...

Share This Page