Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Local webpage to pull data from SQL

Author  Topic 

s_anr
Yak Posting Veteran

81 Posts

Posted - 2009-06-09 : 02:49:41
Hi SQL Gurus,

I have created a SQLview from a query which would reveal the following results from the server "my-server" with UN = user and password = pwd :

Ticket Open_Date Close_Date Group
12345 12-05-2009 00:12:00 12-05-2009 00:15:00 SQL
45678 12-05-2009 00:12:00 12-05-2009 00:15:00 TSQL
76890 13-05-2009 00:12:00 12-05-2009 00:15:00 MYSQL
67900 13-05-2009 00:12:00 12-05-2009 00:15:00 SQL
56789 14-05-2009 00:12:00 12-05-2009 00:15:00 TSQL
96789 14-05-2009 00:12:00 12-05-2009 00:15:00 SQL

How can I create a webpage in ASP / JSP Page so that I can launch it in IIS and it should have four fields as given below :

Open_Date(Initial) Open Date (End) Group GO

When I enter the Open_Date(Initial) and Open_date (End), select a group from Drop down (e.g. SQL). It should give me all the ticket information (All rows from the table) where Open_date is in between the Dates specified. When I click on GO, I should be able to save it as an excel sheet.

Any help would be appreciated.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-09 : 12:56:56
the webpage should be designed using your front end language like VB ASP,ASP.NET,... the backend query will be something like


SELECT *
FROM Table
WHERE Group='SQL'
AND Open_date BETWEEN Open_Start_Date AND Open_End_Date


for saving in excel you need to write code in your vb or asp
Go to Top of Page

s_anr
Yak Posting Veteran

81 Posts

Posted - 2009-06-09 : 15:06:37
Yes I understand that I need to run this quey in the backend. But How do I link it in a webpage? This is where i'm stuck. I'm not a webdesigner but can work on SQL. I have posted this in this forum so that someone who knows SQL as well as web designing.

Any help!!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-10 : 13:58:10
you can call query from asp page using ado connection

http://www.w3schools.com/ado/met_conn_execute.asp

Go to Top of Page

Stevan2020
Starting Member

25 Posts

Posted - 2009-07-23 : 14:50:14
This example uses ASP and a DSN for the connection to the DB. You could change that to a DSNless conmnection.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Set rsOffices_cmd = Server.CreateObject ("ADODB.Command")
rsOffices_cmd.ActiveConnection = "dsn=yourDB;uid=yourID;pwd=yourPWD;"
rsOffices_cmd.CommandText = "Select OfficeID, ShortOffice From tbl_Offices"
rsOffices_cmd.Prepared = true

Set rsOffices = rsOffices_cmd.Execute
rsOffices_numRows = 0
%>


<table>
<tr>
<th>OfficeID</th>
<th>Office</th>
</tr>
<%
While NOT rsOffices.EOF
%>
<tr>
<td><%=rsOffices("OfficeID")%></td>
<td><%=rsOffices("ShortOffice")%></td>
</tr>
<%
rsOffices.MoveNext()
Wend
%>
</table>
<%
rsOffices.Close()
Set rsOffices = Nothing
%>
Go to Top of Page
   

- Advertisement -