Click here to Skip to main content
15,891,708 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: table asp Pin
tek 20092-Jun-10 6:42
tek 20092-Jun-10 6:42 
AnswerRe: table asp Pin
Baconbutty3-Jun-10 0:59
Baconbutty3-Jun-10 0:59 
Questiongenerate xml file with sql query Pin
amina892-Jun-10 4:11
amina892-Jun-10 4:11 
QuestionRe: generate xml file with sql query Pin
Rhys Jacob2-Jun-10 4:21
Rhys Jacob2-Jun-10 4:21 
AnswerRe: generate xml file with sql query Pin
dan!sh 2-Jun-10 4:43
professional dan!sh 2-Jun-10 4:43 
GeneralRe: generate xml file with sql query Pin
amina892-Jun-10 10:49
amina892-Jun-10 10:49 
GeneralRe: generate xml file with sql query Pin
dan!sh 2-Jun-10 16:53
professional dan!sh 2-Jun-10 16:53 
QuestionRe: generate xml file with sql query Pin
amina892-Jun-10 20:04
amina892-Jun-10 20:04 
Hi,
I already tried the method of the gridview but I have hundreds of students in a module managing the grid is heavy.
To excel I try this code
  cn.Open();
       SqlDataAdapter da = new SqlDataAdapter(@"DECLARE @MATIERE nvarchar(max)
SELECT @MATIERE =
  STUFF(
  (
  select distinct ',[' + LIBELLE_MATIERE + ']'
  from MATIERE where CODE_MODULE =11
  for xml path('')
 ),
 1,1,'')
 
DECLARE @SQL nvarchar(max)
SELECT @SQL = N'
select
 *
from (
 
  SELECT     ETUDIANT.NUM_INSCRIPTION, ETUDIANT.NOM_PRENOM_ETUDIANT_ARABE,EXAMEN.CODE, 
 EXAMEN.NOTE, 
                     MATIERE.LIBELLE_MATIERE
FROM         ETUDIANT INNER JOIN
                      EXAMEN ON ETUDIANT.NUM_INSCRIPTION = EXAMEN.NUM_INSCRIPTION INNER JOIN
                      CAPITALISE_MODULE ON 
                      ETUDIANT.NUM_INSCRIPTION = CAPITALISE_MODULE.NUM_INSCRIPTION INNER JOIN
                      MATIERE ON EXAMEN.CODE_MATIERE = MATIERE.CODE_MATIERE INNER JOIN
                      MODULE ON CAPITALISE_MODULE.CODE_MODULE = MODULE.CODE_MODULE 
                      AND MATIERE.CODE_MODULE = MODULE.CODE_MODULE
WHERE      (CAPITALISE_MODULE.CODE_MODULE = 11) AND 
                      (CAPITALISE_MODULE.CODE_TYPE_RELATION_MODULE = 1)
) Data
PIVOT (
 SUM(NOTE)
 FOR LIBELLE_MATIERE
 IN (
  ' + @MATIERE + '
 )
) PivotTable
'
 
exec sp_executesql @SQL
 
", cn);
       DataTable dt = new DataTable();
       da.Fill(dt);
       cn.Close();
 
       Response.Clear();
       Response.ContentType = "application/vnd.ms-excel";
       string sep = "";
       foreach (DataColumn dc in dt.Columns)
       {
              Response.Write(sep + dc.ColumnName);
              sep = "\t";
       }
       Response.Write("\n");
 
       int i;
       foreach (DataRow dr in dt.Rows)
       {
              sep = "";
              for (i = 0; i < dt.Columns.Count; i++)
              {
                     Response.Write(sep + dr[i].ToString());
                     sep = "\t";
              }
              Response.Write("\n");
       }
 
}
 
 
   
}


excel file generated by this code gives me this:
Sudeni_id_____marks_matter1____marks_matte2
but how to allow just the marks between 0 and 20?
is a method to calculate the average module directl:ysum(marks_matter1*coefficient)/sum(coefficent)
I chose XML because it's easy to send to the database(I read that in an article )but i have a problem with generate it with sql,excel i dont have any edea if the data are not the same table.
Thanks
Questionhow to print iframe contents without opening print dialog [modified] Pin
raghvendrapanda2-Jun-10 1:44
raghvendrapanda2-Jun-10 1:44 
AnswerRe: how to print iframe contents without opening print dialog Pin
JHizzle2-Jun-10 2:34
JHizzle2-Jun-10 2:34 
GeneralRe: how to print iframe contents without opening print dialog Pin
raghvendrapanda2-Jun-10 2:57
raghvendrapanda2-Jun-10 2:57 
GeneralRe: how to print iframe contents without opening print dialog Pin
JHizzle3-Jun-10 3:11
JHizzle3-Jun-10 3:11 
QuestionHow to Develop Hosting Website using Asp.net Pin
Member 47201842-Jun-10 0:42
Member 47201842-Jun-10 0:42 
AnswerRe: How to Develop Hosting Website using Asp.net Pin
Peace ON2-Jun-10 2:36
Peace ON2-Jun-10 2:36 
GeneralRe: How to Develop Hosting Website using Asp.net Pin
Jason Vetter3-Jun-10 11:11
Jason Vetter3-Jun-10 11:11 
Questionretrive client logical drives in alternative of Directory.GetLogicalDrive which used in server side Pin
Punit Belani1-Jun-10 23:45
Punit Belani1-Jun-10 23:45 
AnswerRe: retrive client logical drives in alternative of Directory.GetLogicalDrive which used in server side Pin
Sandeep Mewara2-Jun-10 0:00
mveSandeep Mewara2-Jun-10 0:00 
GeneralRe: retrive client logical drives in alternative of Directory.GetLogicalDrive which used in server side Pin
Punit Belani2-Jun-10 0:09
Punit Belani2-Jun-10 0:09 
AnswerRe: retrive client logical drives in alternative of Directory.GetLogicalDrive which used in server side Pin
walterhevedeich2-Jun-10 0:11
professionalwalterhevedeich2-Jun-10 0:11 
GeneralRe: retrive client logical drives in alternative of Directory.GetLogicalDrive which used in server side Pin
Punit Belani2-Jun-10 0:19
Punit Belani2-Jun-10 0:19 
QuestionRedirect with querystring Pin
Dot-Net-Dev1-Jun-10 23:30
Dot-Net-Dev1-Jun-10 23:30 
AnswerRe: Redirect with querystring Pin
Sandeep Mewara1-Jun-10 23:36
mveSandeep Mewara1-Jun-10 23:36 
GeneralRe: Redirect with querystring Pin
Dot-Net-Dev2-Jun-10 0:32
Dot-Net-Dev2-Jun-10 0:32 
GeneralRe: Redirect with querystring Pin
JHizzle2-Jun-10 1:01
JHizzle2-Jun-10 1:01 
AnswerRe: Redirect with querystring Pin
Punit Belani1-Jun-10 23:57
Punit Belani1-Jun-10 23:57 

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.