Showing posts with label enter. Show all posts
Showing posts with label enter. Show all posts

Thursday, March 22, 2012

arabic numeral

how to enter arabic numerals in sql server 2005 fields?
like ????????

The column will have to use a unicode datatype like nvarchar and the client application will have to use appropiate parameters which support unicode. if you use adhoc statements in your application, make sure you are using an N as a prefix for strings, e.g. N'SomeString'

Jens K. Suessmeyer


http://www.sqlserver2005.de

Monday, February 13, 2012

Apostrphe Usage

How do you allow clients to enter text that contains an apostrophe?
Thanks!since the udfunctions were invented, it's not more a problem.|||...my clients are having trouble entering data if it contains apostrophes. Here is the code that they are using:

sql = "INSERT INTO TrainingData (PartID, TrngDate, TimeDay, Effort, UnitMeas, Partners, Comments, DateSubmt) "

sql = sql & "VALUES (" & Session("partid") & ", '" & CDate(strDateRun) & "', '" & Request.Form("ampm") & "', " & CInt(strEffort)

sql = sql & ", '" & strUnitMeas & "', '" & Request.Form("partners") & "', '" & Request.Form("comments") & "', '" & Date & "')"

Set rs = conn.Execute(sql)
Set rs =Nothing

If the comments or partners field contains an apostrophe, we seem to have a problem. How should I modify my code?

Thanks for your time!!!!|||If you need to insert apostrophies in SQL, make it a double apostrophie.
Like...

Insert into Table (Field1) Values ('That''s That')

In VB, just use:
Replace(sSQL,"'","''")

Works like a charm

Hope this helps.