Hi. I want to retrieve values from a table which is in sql server to ASP page. How to do this? Please tell me.Thanks in advance.
Heres another search which came back with some good stuff.. http://www.google.com/search?q=sql+server+connect+asp Good Luck with it
connection and all other things are OK but I want to retrieve the values in table format from sql server to ASP.
If you are using ADO then this will help: <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.whatever" conn.Open(Server.Mappath("/whatever.mdb")) set rs = Server.CreateObject("ADODB.recordset") rs.Open "SELECT whatever", conn %> <table border="1" width="100%"> <%do until rs.EOF%> <tr> <%for each x in rs.Fields%> <td><%Response.Write(x.value)%></td> <%next rs.MoveNext%> </tr> <%loop rs.close conn.close %> I usd 'whatever' as text to be replaced. If you want a header for the table, create it before the do until loop. You might also add an else clause to display when there are no records.
retrieve the data as a table? As in a DataTable? If you use strongly typed datasets, you can create a datatble directly filled from your query. Then you can directly bind that datatable to a gridview (or whatever control you want)
Ccoonen, I'm pretty sure they're talking about classic ASP. But still...datasets and typed datasets are fine, but most of the programmers I know who have dealt with a lot of pain involved with debugging them in complex scenarios (say, tracing them across multiple web service calls) highly recommend just using custom business objects instead. (Not that that's relevant to this thread, I don't think).