I'm not an expert in ASP but can manage. I am writing a script to randomly select text from the database. (Microsoft Access). The database has (Sankrit font) Proverbs that I am displaying randomly on the home page. The script that I have written does the job but when displaying the text I get (????????????????????/???) I'm sure it is problem with text that needs to be displayed. here is an ex: of what is stored in the databse.
नेहाभिक्रमनाशोस्ति प्रत्यवायो न विद्यते ।
स्वल्पमप्यस्य धर्मस्य त्रायते महतो भयात् ॥२-४०॥
When I run the script for showing all the records in the table the proverb is shown perfectly but it is not the same on when showing randomly. I'm not sure why?
Below is the script that I have used for random.
Expand|Select|Wrap|Line Numbers
- <%
- Option Explicit
- Response.Buffer = True
- %>
- <html>
- <head>
- <style>
- p { font-family:verdana; font-size:11px; }
- </style>
- </head>
- <body>
- <br><p align="center">
- <%
- ' ADO Constant. Dont change this
- Const adCmdText = &H0001
- ' Connection string and SQL statement
- Dim query, connStr
- query = "select sloka from Slokas"
- connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
- Server.MapPath("slokas.mdb")
- ' Opening database
- Dim rs
- Set rs = Server.CreateObject("ADODB.Recordset")
- rs.Open query, connStr, 3, , adCmdText
- ' Generating random number from total number of records
- Dim intRnd
- Randomize Timer
- intRnd = (Int(RND * rs.RecordCount))
- ' Now moving the cursor to random record number
- rs.Move intRnd
- ' Showing the random statement
- Response.Write "<b>" & rs("Sloka") & "</b>"
- ' Closing the database
- rs.Close
- Set rs = Nothing
- %>
- </p>
- </body>
- </html>
Thanks,
Raam