Click here to Skip to main content
15,892,927 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Click-in and Click out functionality Pin
Sandeep Mewara4-May-10 21:20
mveSandeep Mewara4-May-10 21:20 
GeneralRe: Click-in and Click out functionality Pin
PeriyasamyRamachandran4-May-10 22:57
PeriyasamyRamachandran4-May-10 22:57 
GeneralRe: Click-in and Click out functionality Pin
PeriyasamyRamachandran5-May-10 1:22
PeriyasamyRamachandran5-May-10 1:22 
GeneralRe: Click-in and Click out functionality Pin
PeriyasamyRamachandran5-May-10 19:06
PeriyasamyRamachandran5-May-10 19:06 
QuestionCompositeWebClientLibrary that supports Enterprise Library 4.1 Pin
Shahdat Hosain4-May-10 18:43
Shahdat Hosain4-May-10 18:43 
QuestionFileInfo type with FileUpload Pin
AndyASPVB4-May-10 9:33
AndyASPVB4-May-10 9:33 
AnswerRe: FileInfo type with FileUpload Pin
PunkIsNotDead4-May-10 19:10
PunkIsNotDead4-May-10 19:10 
QuestionWhat is the best method Pin
amina894-May-10 7:50
amina894-May-10 7:50 
Hello
I work on an intranet site management fees.
management part of review tired me, I chose to work with Excel for simplicity
That's what I want to do:
I have a listbox containing the modules , for a list of students registered in a module, the responsable for this must complete an authentication form.
I want that after authenticating the excel file containing the student opens (I do not know if this is the right method, you comments are welcome)
to export data from sqlserver to excel I used 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");
       }
 
}


   
}


this code works with sql queries simple but with my query i had an empty excel file (I tried this query and she is correct).
Should I display data in gridview and the user clicks on a button to export to excel?
If a person already working on this project thank you to advise me.
Thank you very much.
AnswerRe: What is the best method Pin
Viral Upadhyay4-May-10 18:53
Viral Upadhyay4-May-10 18:53 
GeneralRe: What is the best method Pin
amina894-May-10 22:15
amina894-May-10 22:15 
GeneralRe: What is the best method Pin
Viral Upadhyay4-May-10 23:49
Viral Upadhyay4-May-10 23:49 
GeneralRe: What is the best method Pin
amina895-May-10 0:16
amina895-May-10 0:16 
Questiondatalist display adsense after particular row Pin
uglyeyes4-May-10 6:40
uglyeyes4-May-10 6:40 
AnswerRe: datalist display adsense after particular row Pin
RCoate4-May-10 19:54
RCoate4-May-10 19:54 
GeneralRe: datalist display adsense after particular row Pin
uglyeyes9-May-10 20:36
uglyeyes9-May-10 20:36 
QuestionMessagebox in webform Pin
Enobong Adahada4-May-10 5:50
Enobong Adahada4-May-10 5:50 
AnswerRe: Messagebox in webform Pin
JHizzle4-May-10 5:55
JHizzle4-May-10 5:55 
AnswerRe: Messagebox in webform Pin
michaelschmitt4-May-10 6:06
michaelschmitt4-May-10 6:06 
GeneralRe: Messagebox in webform Pin
Enobong Adahada4-May-10 6:58
Enobong Adahada4-May-10 6:58 
GeneralRe: Messagebox in webform Pin
T M Gray4-May-10 7:43
T M Gray4-May-10 7:43 
GeneralRe: Messagebox in webform Pin
michaelschmitt4-May-10 7:46
michaelschmitt4-May-10 7:46 
AnswerRe: Messagebox in webform Pin
Abhijit Jana4-May-10 7:24
professionalAbhijit Jana4-May-10 7:24 
QuestionFixed gridview header is wider than gridview Pin
Andraw1114-May-10 5:45
Andraw1114-May-10 5:45 
QuestionClear Textbox without writing server side code EnableViewState=false? Pin
Sandesh M Patil4-May-10 4:46
Sandesh M Patil4-May-10 4:46 
AnswerRe: Clear Textbox without writing server side code EnableViewState=false? Pin
Mike Ellison4-May-10 6:04
Mike Ellison4-May-10 6:04 

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.