Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Query to ASP.NET Query, WHERE Prob

Status
Not open for further replies.

Corneliu

Technical User
Sep 16, 2002
141
US
Hi.
I am just starting to migrate to ASP.NET from ASP and just need a little help PLZ, with the WHERE STATEMENT IN SQL QUERY. Been looking everywhere, forums, search, etc. Could not find anything.
All works well in ASP Page, and All works well in ASP.NET Page except I DO NOT KNOW how to make it so that it only displays the records from a particular site, or week, or whatever the case may be.

In ASP, I would do the statement like this:
<%
Sitenum = Request.QueryString(&quot;Sitenum&quot;)

Set RS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
SqlString = &quot;SELECT SUM(TicketCount) as ticketsum, Tickets.Technician, Technicians.Technician as Technician_Name, Tickets.Site, Sites.SiteName as Site_Name, Tickets.Week &quot;
SqlString = SqlString & &quot; FROM (Tickets INNER JOIN Technicians ON Tickets.Technician = Technicians.TechnicianID) INNER JOIN Sites ON Tickets.Site = Sites.SiteID&quot;
SqlString = SqlString & &quot; WHERE Tickets.Site = '&quot; & Sitenum & &quot;'&quot;

Set RS = objConn.Execute ( SqlString )
%>

In ASP.NET I HAVE THIS:
<%@ Page Language=&quot;VB&quot; ContentType=&quot;text/html&quot; ResponseEncoding=&quot;iso-8859-1&quot; %>
<%@ Register TagPrefix=&quot;MM&quot; Namespace=&quot;DreamweaverCtrls&quot; Assembly=&quot;DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral&quot; %>
<MM:DataSet
id=&quot;ListingTickets&quot;
runat=&quot;Server&quot;
IsStoredProcedure=&quot;false&quot;
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings(&quot;MM_CONNECTION_STRING_Reports&quot;) %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings(&quot;MM_CONNECTION_DATABASETYPE_Reports&quot;) %>'
CommandText='<%# &quot;SELECT Tickets.TicketCount, Tickets.Week, Tickets.Site, Tickets.Technician, Sites.SiteName as Site_Name, Technicians.Technician as Tech_Name FROM Tickets INNER JOIN Technicians ON Tickets.Technician = Technicians.TechnicianID INNER JOIN Sites ON Tickets.Site = Sites.SiteID WHERE this is where I need help&quot; %>'
PageSize=&quot;10&quot;
Debug=&quot;true&quot;
>
</MM:DataSet>
<MM:pageBind runat=&quot;server&quot; PostBackBind=&quot;true&quot; />

And how do I bring in the aspx page the requeststring?

In ASP I do:
ListTickets.asp?Sitenum=1 or 2 or whatever
and the ASP Page would have:
Sitenum = Request.QueryString(&quot;Sitenum&quot;)

Now in ASP.NET would be what:

Thank You Very Much For Your Help.
 
is there a reason that you are not using the codebehind.... this is accomplished much easier...
 
I don't know what you need help with in your WHERE clause. But for you second question, you do the same thing.
 
I got it. I just didnt know how to get a querystring from an ASP Page. I got it now and works great.
Thank you for your help.
Now I am kickin myself with the footer. Want to get the totals.

Thankx for the help.
 
Footer for what? Do you have a DataGrid and you want to get the totals for that? I've found a page with a sample for that that I've used if that is what you are after.

Do you code any of your ASP.Net in the VB or C# editor as opposed to the HTML? Just interested.
 
I am using Dreamweaver MX VB coding. If you can get me that Link I would appreciate it.
When using DW MX is does the code a little strange. I am getting some books now to try to understand how ASP.NET works. I work in ASP pretty much, but like the way ASP.NET does thigns so I want to learn it.

Thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top