Click here to Skip to main content
16,004,653 members

Comments by Member 11819086 (Top 27 by date)

Member 11819086 29-Oct-15 2:19am View    
here exactly the control jumps....


xlWorkBook = xlApp.Workbooks.Open(fname, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
Member 11819086 29-Oct-15 2:18am View    
here i am attaching my code please correct me.....


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;
//using System.Windows.Forms;
using Microsoft.Office.Interop.Excel;
using System.IO;
namespace ASPNetFileUpDownLoad
{
public partial class exceltest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void Button1_Click(object sender, EventArgs e)
{

Microsoft.Office.Interop.Excel.Application xlApp;
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;

string fileName = this.FileUpload1.FileName;



FileInfo ff = new FileInfo(fileName);
if (ff.Exists)
{



switch (System.IO.Path.GetExtension(this.FileUpload1.PostedFile.FileName))
{
case ".xlsx":
case ".xls":
case ".csv":
{

// this.InsertAssayOutputFileData();
//objHTSBO.InsertAssayOutputFileData();

//objHTSBO.InsertAssayOutputFileData();
string str3 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"App_Data\UploadFiles\" + fileName);

// string cmpexelfname = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"App_Data\CMPDATAFILES\" + filenamecmp);
// this.GetExcel(str3);
// this.getcmpexcel(cmpexelfname);
string fname = str3;

xlApp = new Microsoft.Office.Interop.Excel.Application();


//xlWorkBook = xlApp.Workbooks.Open(Server.MapPath("ASPNetFileUpDownLoad.xlsx"), true, true);



xlWorkBook = xlApp.Workbooks.Open(fname, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

//MessageBox.Show(xlWorkSheet.get_Range("A1", "A1").Value2.ToString());

xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();

releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);

return;
}
}
}






}
private void releaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
obj = null;
}
catch (Exception ex)
{
obj = null;
// MessageBox.Show("Unable to release the Object " + ex.ToString());
}
finally
{
GC.Collect();
}
}


}
}
Member 11819086 18-Oct-15 14:57pm View    
sg 1033, Level 15, State 1, Line 9
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
Member 11819086 18-Oct-15 14:34pm View    
Msg 156, Level 15, State 1, Line 15
Incorrect syntax near the keyword 'order'.
i am getting tthe error..
Member 11819086 8-Oct-15 7:05am View    
Dear Raju please send me where i have to set above GridView1_RowDataBound() in my code..???please help me