Click here to Skip to main content
15,885,216 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: User access and options validation Pin
emiaj17-Jan-08 14:25
emiaj17-Jan-08 14:25 
GeneralRe: User access and options validation Pin
bokuceres17-Jan-08 16:22
bokuceres17-Jan-08 16:22 
GeneralRe: User access and options validation Pin
emiaj18-Jan-08 2:53
emiaj18-Jan-08 2:53 
GeneralASP.NET projects without IIS Pin
Diego F.17-Jan-08 6:51
Diego F.17-Jan-08 6:51 
GeneralRe: ASP.NET projects without IIS Pin
pmarfleet17-Jan-08 8:31
pmarfleet17-Jan-08 8:31 
QuestionExcelSheet Problem Pin
rishi.kasnia17-Jan-08 4:50
rishi.kasnia17-Jan-08 4:50 
GeneralRe: ExcelSheet Problem Pin
Paddy Boyd17-Jan-08 5:28
Paddy Boyd17-Jan-08 5:28 
GeneralRe: ExcelSheet Problem Pin
rishi.kasnia17-Jan-08 17:59
rishi.kasnia17-Jan-08 17:59 
Ya i am creating objects on server. I am pasting the code for your refrence.



Excel.Application ExlApp;
Excel.Workbook ExlBook;
Excel.Worksheet ExlSheet;

DataTable Dt = new DataTable();
SqlConnection ConnObj;






void GenerateExcelSheet()
{
try
{
ConnObj = new SqlConnection("Server =.;database=parnam;user id=sa;password=");

ExlApp = new Excel.ApplicationClass();
//System.Globalization.CultureInfo OldCL = System.Threading.Thread.CurrentThread.CurrentCulture;
//System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
ExlBook = ExlApp.Workbooks.Add(Type.Missing);
ExlApp.Visible = true;
ExlBook.Application.Visible = true;
//ExlSheet = (Excel.Worksheet)ExlBook.Worksheets[1];
ExlSheet = (Excel.Worksheet)ExlBook.ActiveSheet;
ExlSheet.Name = "Report";

string SQL = "select society_code, society_name,shift_date,shift,round (fat,2),clr,snf,milk_qty,totalamount,deductamount,netamount from trucksheet";
// ConnObj = new SqlConnection(ConfigurationSettings.AppSettings["cn"]);
ConnObj.Open();
SqlDataAdapter Da = new SqlDataAdapter(SQL, ConnObj);
DataTable Dt = new DataTable();
Da.Fill(Dt);
ConnObj.Close();
Da.Dispose();
for (int i = 1; i <= 10; i++)
{
((Excel.Range)ExlSheet.Cells[1, i]).Font.Bold = true;
}
((Excel.Range)ExlSheet.Cells[1, 1]).Value2 = "Society Code";
((Excel.Range)ExlSheet.Cells[1, 2]).Value2 = "Society Name";
((Excel.Range)ExlSheet.Cells[1, 3]).Value2 = "Shift Date";
((Excel.Range)ExlSheet.Cells[1, 4]).Value2 = "Shift";
((Excel.Range)ExlSheet.Cells[1, 5]).Value2 = "F.A.T";
((Excel.Range)ExlSheet.Cells[1, 6]).Value2 = "C.L.R";
((Excel.Range)ExlSheet.Cells[1, 7]).Value2 = "S.N.F";
((Excel.Range)ExlSheet.Cells[1, 8]).Value2 = "Milk Quantity";
((Excel.Range)ExlSheet.Cells[1, 9]).Value2 = "Total Amount";
((Excel.Range)ExlSheet.Cells[1, 10]).Value2 = "Deduct Amount";
((Excel.Range)ExlSheet.Cells[1, 11]).Value2 = "Net Amount";


for (int r = 2, i = 0; r < Dt.Rows.Count; r++, i++)
{
for (int c = 1, j = 0; c <= Dt.Columns.Count; c++, j++)
{
// ((Excel.Range)ExlSheet.Cells[k, 3]).Value2 = DtAcc.Rows[0][0].ToString();
((Excel.Range)ExlSheet.Cells[r, c]).Value2 = Dt.Rows[i][j].ToString();
}

}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
GeneralRe: ExcelSheet Problem Pin
Paddy Boyd17-Jan-08 21:23
Paddy Boyd17-Jan-08 21:23 
GeneralRe: ExcelSheet Problem Pin
rishi.kasnia17-Jan-08 23:10
rishi.kasnia17-Jan-08 23:10 
GeneralCheck installed software Pin
C. L. Phillip17-Jan-08 3:17
C. L. Phillip17-Jan-08 3:17 
GeneralRe: Check installed software Pin
Vasudevan Deepak Kumar17-Jan-08 3:51
Vasudevan Deepak Kumar17-Jan-08 3:51 
GeneralRe: Check installed software Pin
C. L. Phillip17-Jan-08 20:32
C. L. Phillip17-Jan-08 20:32 
GeneralRe: Check installed software Pin
N a v a n e e t h17-Jan-08 21:38
N a v a n e e t h17-Jan-08 21:38 
Questionmessage box problem Pin
Pankaj Garg17-Jan-08 3:07
Pankaj Garg17-Jan-08 3:07 
GeneralRe: message box problem Pin
Vasudevan Deepak Kumar17-Jan-08 4:18
Vasudevan Deepak Kumar17-Jan-08 4:18 
GeneralChaging UI on different occasions Pin
King Shez17-Jan-08 3:07
King Shez17-Jan-08 3:07 
GeneralRe: Chaging UI on different occasions Pin
Vasudevan Deepak Kumar17-Jan-08 4:19
Vasudevan Deepak Kumar17-Jan-08 4:19 
GeneralRe: Chaging UI on different occasions Pin
Paddy Boyd17-Jan-08 5:30
Paddy Boyd17-Jan-08 5:30 
Questionscript manager error Pin
Pankaj Garg17-Jan-08 2:58
Pankaj Garg17-Jan-08 2:58 
GeneralRetrieving Images in DataList Pin
Aigreen17-Jan-08 2:43
Aigreen17-Jan-08 2:43 
QuestionRe: Retrieving Images in DataList Pin
Pankaj Garg17-Jan-08 2:49
Pankaj Garg17-Jan-08 2:49 
GeneralRe: Retrieving Images in DataList Pin
Aigreen17-Jan-08 2:56
Aigreen17-Jan-08 2:56 
GeneralRe: Retrieving Images in DataList Pin
Pankaj Garg17-Jan-08 2:59
Pankaj Garg17-Jan-08 2:59 
GeneralRe: Retrieving Images in DataList Pin
Aigreen17-Jan-08 3:07
Aigreen17-Jan-08 3:07 

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.