By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

java script to read data from database

P: 10
Hi, hope someone can help me. It seems imposible to read data from a server, however, I can read the validation data from the server and hold it in dataviews . datasets or data tables in my asp "load" page. I would like to use these data (which I presume is in some form of html or xml) in my HTML portion of the asp page. The data must be read using java script and after lots of calculations perform on it - be written to xml controls.
I can also write the data in the aspx page to the hard drive in xml format, but dont know yet to read it into java script arrays.

I use vb.net on the aspx page. I read the validation data from a sequal server and can keep it in views / datasets or tables or write it as a xml file.
The validations wil be done on the client side using java script. (no submit buttons involved - so no postback and page building. validation data will be read in the pageload section. Please help me

I hope I made myself clearly in my question.

Thanking you
Oct 16 '06 #1
Share this Question
Share on Google+
4 Replies


P: 50
So, is it that you want to construct dynamic js arrays using the values in your dataset???
Or better yet,,,,,,, a custom javascript object!!!
Oct 16 '06 #2

P: 10
So, is it that you want to construct dynamic js arrays using the values in your dataset???
Or better yet,,,,,,, a custom javascript object!!!

Any means of having the data from the dataset available in my javascript. Logically, arrays would be the answer in most cases, but some of the "validation records" is up to 400 records, then arrays would slow down performance ( I think) I just need a way of having about 8 tables / datasets available for my javscript. The tables exist in vb.net (aspx page)
Thanking you
Oct 17 '06 #3

P: 50
What you are going to do is mix vbscript with javascript.
It is important to understand that the server does not see the javascript.
It merely process the vbscript and will convert your code to values before sending the page to the client machine. It is the client system which sees the javascript, but not the vbscript! Instead it will only see the values created by the server which interpreted the vbscript....

So.
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript1.2" type="text/javascript">
  2. var allRecords = [
  3. <%While  (NOT rs_yours.EOF)%>
  4. {field_name1:"<%=(rs_yours.Fields.Item("foo1").Value)%>",field_name2:"<%=(rs_yours.Fields.Item("foo2").Value)%>"} 
  5. <%
  6. rs_yours.MoveNext() 
  7. Wend
  8. %>
  9. ]
  10. </script>
Is basically what you want to accomplish.
Oct 17 '06 #4

P: 50
If you wanna get more tricky with it, check this out:
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=161
Oct 17 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.