Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript C#3.5
how to get data in sql 2005 using javascript in asp.net
 
and show in gridview
Posted 5-Jun-12 23:23pm
sonutak618
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

One known method is using AJAX to read data. You should have your server side logic to fetch data. Then you can use your AJAX class to load data to grid .
 
Regards
Sebastian
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

YOu can use raw-ajax function to get value from server
which uses XML Object
i.e.
 
 

 function getValueByAjax(url,getxml)
    {
        
        
        var req;
        try {
         req = new XMLHttpRequest();  //e.g. Firefox
         } catch(err1) {
           try {
           req = new ActiveXObject('Msxml2.XMLHTTP'); // some versions IE 
           } catch (err2) {
             try {
             req = new ActiveXObject("Microsoft.XMLHTTP"); // some versions IE 
             } catch (err3) {
              req = false;
             }
           }
         }
   
        req.open("GET", url  ,false);
      
        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        
        req.send();
        var item ;
        if(req.readyState == 4) 
        {   
           if(req.status == 200) 
           {
              item = req.responseText;
              if(getxml==1)
              {
                 item = req.responseXML;
              }
           }
        }
      
         return item;
    }
    
 
and do process from server side
 
and manupulate returned string as you want...
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

get data in sql 2005 using javascript
Database will be on server side. So you need to use techniques that will allow you to talk to server from JavaScript.
 
There are few ways to interact with server side through client side(Javascript):
1. XMLHttpRequest[^]
2. Callback[^]
3. WebService call[^]
4. PageMethod[^]
 
Try the one that suits you.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 205
1 Zoltán Zörgő 200
2 Peter Leow 160
3 BillWoodruff 85
4 bling 70
0 Sergey Alexandrovich Kryukov 9,543
1 OriginalGriff 6,901
2 Peter Leow 4,737
3 Zoltán Zörgő 4,404
4 CHill60 2,932


Advertise | Privacy | Mobile
Web01 | 2.8.150129.1 | Last Updated 6 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100