pwint
Newbie
Posts: 1
Registered: 2/10/2005
Member Is Offline
|
| posted on 2/10/2005 at 02:21 AM |
|
|
Can javascript read the data from MS SQL database?
Hi
I want to try to read the data from SQL database using javascript. When i change something in list/menu in a form it will run in onchange event and
to read the data from SQL database according to the data number that receive from the list/menu in a form. Then this data should be loaded into
another list/menu in the same form.
How can i do it? Can it be done with javascript?
Any help, suggestions welcome.
Pwint
|
|
|
IntranetDeveloper
Junior Member
Posts: 6
Registered: 2/19/2005
Member Is Offline
|
| posted on 2/27/2005 at 04:49 PM |
|
|
Can javascript read the data from MS SQL database?
Why don't you just use asp to pull the data from the database and use the script to handle to formatting?
Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strCon
Set objRec= Server.CreateObject ("ADODB.Recordset")
objRec.cursorlocation=aduseclient
objLevels.sort=" YourFieldName ASC"
strSQL = "SELECT * FROM Yourtable"
objRec.Open strSQL, objCon, adOpenStatic, adLockReadOnly, adCmdText
Do something like this to output your data in the table..
if (not ObjRec.bof) or (not objRec.eof)
Response.Write(CHR(13)&"<tr>")
Response.Write(CHR(13)&"<td>"&objRec("YourFieldName")&"")
Response.Write(CHR(13)&"</tr>")
objRec.movenext
end if
-J
|
|
|