Click here to Skip to main content
16,009,847 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionDirectory Uploading Pin
sukhchain singh17-Nov-06 19:50
sukhchain singh17-Nov-06 19:50 
QuestionHelp About FTP Pin
Deepak the Cool17-Nov-06 19:38
Deepak the Cool17-Nov-06 19:38 
AnswerRe: Help About FTP Pin
Nicejith17-Nov-06 21:16
Nicejith17-Nov-06 21:16 
QuestionApplication_Error in global.asax [modified] Pin
Nagraj Naik17-Nov-06 18:49
Nagraj Naik17-Nov-06 18:49 
QuestionCheckBox with GridView Pin
Gamzun17-Nov-06 18:47
Gamzun17-Nov-06 18:47 
AnswerRe: CheckBox with GridView Pin
dj.rock17-Nov-06 21:49
dj.rock17-Nov-06 21:49 
QuestionHow to find a average Sales Pin
JVVS17-Nov-06 18:48
JVVS17-Nov-06 18:48 
AnswerRe: How to find a average Sales Pin
WillemM18-Nov-06 8:08
WillemM18-Nov-06 8:08 
It really depends on how you saved the data in your database. Does it contain data on items sold and data such as date and bill number?

Although not very optimal you can write something like this:

SELECT AVG(/*Price Field*/) AS AverageSalesPrice, /* Fields */ FROM  /* Bill Item Table */<br />
INNER JOIN /* Bill Table */ ON (/* Bill Item -> Bill ID */ = /* Bill ID */)<br />
WHERE /* Bill Date Field*/ BETWEEN /* Lower Bound */ AND /* Upper Bound */<br />
GROUP BY /* Selected Fields */


The lower bound is here the beginning of the month and the upper bound is the end of the month. Of course you need to provide the right fields to be able to calculate the average sales.

To be able to use this query in your website you need a modification to an existing page or a new page, that has the following code on the Page_Load method or behind a button:

using(SqlConnection conn = new SqlConnection(connectionString)) <br />
{<br />
  conn.Open();<br />
  using(SqlCommand cmd = conn.CreateCommand())<br />
  {<br />
    cmd.CommandText = //Insert query here<br />
    cmd.CommandType = //Set the correct commandtype<br />
<br />
    using(IDataReader reader = cmd.ExecuteReader()) <br />
    {<br />
      //Read the field<br />
    }<br />
  }<br />
}


Hope this helps

WM.

What about weapons of mass-construction?

Questionhow to create reports in asp.net 2003. Pin
monuSaini17-Nov-06 18:29
monuSaini17-Nov-06 18:29 
Generalvgdsz Pin
mahili17-Nov-06 18:14
mahili17-Nov-06 18:14 
GeneralRe: vgdsz Pin
Suresh Pirsquare17-Nov-06 18:21
Suresh Pirsquare17-Nov-06 18:21 
QuestionInsert Row in Database Pin
monika_vasvani17-Nov-06 16:24
monika_vasvani17-Nov-06 16:24 
AnswerRe: Insert Row in Database Pin
Gamzun18-Nov-06 3:48
Gamzun18-Nov-06 3:48 
GeneralRe: Insert Row in Database Pin
indianet19-Nov-06 11:41
indianet19-Nov-06 11:41 
QuestionControlling POST action in ASP.NET v. 1.1 ? Pin
GregStevensCA17-Nov-06 12:58
GregStevensCA17-Nov-06 12:58 
AnswerRe: Controlling POST action in ASP.NET v. 1.1 ? Pin
indianet17-Nov-06 13:28
indianet17-Nov-06 13:28 
GeneralRe: Controlling POST action in ASP.NET v. 1.1 ? Pin
GregStevensCA17-Nov-06 14:11
GregStevensCA17-Nov-06 14:11 
GeneralRe: Controlling POST action in ASP.NET v. 1.1 ? Pin
indianet18-Nov-06 11:12
indianet18-Nov-06 11:12 
GeneralRe: Controlling POST action in ASP.NET v. 1.1 ? Pin
GregStevensCA18-Nov-06 18:09
GregStevensCA18-Nov-06 18:09 
QuestionForm Validation Pin
vct17-Nov-06 10:47
vct17-Nov-06 10:47 
AnswerRe: Form Validation Pin
Nicejith17-Nov-06 20:40
Nicejith17-Nov-06 20:40 
AnswerRe: Form Validation Pin
Gamzun18-Nov-06 0:43
Gamzun18-Nov-06 0:43 
QuestionCustomized DataGrid-urgent Pin
nour12317-Nov-06 9:16
nour12317-Nov-06 9:16 
AnswerRe: Customized DataGrid-urgent Pin
leckey17-Nov-06 10:29
leckey17-Nov-06 10:29 
GeneralRe: Customized DataGrid-urgent Pin
nour12318-Nov-06 1:22
nour12318-Nov-06 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.