Click here to Skip to main content
15,902,275 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Export To Excel in ASP.Net Pin
Ramkumar_S20-Apr-11 23:28
Ramkumar_S20-Apr-11 23:28 
QuestionWhy are random images not loading properly in my asp .net page? Pin
fjaccarino19-Apr-11 15:51
fjaccarino19-Apr-11 15:51 
AnswerRe: Why are random images not loading properly in my asp .net page? Pin
J a a n s19-Apr-11 18:51
professionalJ a a n s19-Apr-11 18:51 
Questionpostback reference for buttons Pin
Ali Al Omairi(Abu AlHassan)19-Apr-11 11:43
professionalAli Al Omairi(Abu AlHassan)19-Apr-11 11:43 
QuestionIssues with MsgBox result Pin
Bomb_shell19-Apr-11 11:00
Bomb_shell19-Apr-11 11:00 
AnswerRe: Issues with MsgBox result Pin
Tarakeshwar Reddy19-Apr-11 11:20
professionalTarakeshwar Reddy19-Apr-11 11:20 
AnswerRe: Issues with MsgBox result Pin
Om Prakash Pant21-Apr-11 21:10
Om Prakash Pant21-Apr-11 21:10 
Questiongetting excel sheet current sheet name in asp.net Pin
Dhyanga19-Apr-11 5:42
Dhyanga19-Apr-11 5:42 
Hi, I am trying to read excel file uploaded by the user. So the excel sheet name varies by the user. So if I give particular sheet name, it is working fine but I want to get the sheet name automatically when the user uploads the excel file. The sheet name should be the name of the current sheet opened in the excel file. How to do that ?

For example:
if my code below is like this:
protected void ExcelConnection(string filename)
{
	string xConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath(Session["foldername"].ToString() + filename) + ";" + "Extended Properties=Excel 8.0;";
    // create your excel connection object using the connection string
    OleDbConnection objXConn = new OleDbConnection(xConnStr);
    // Create a new Adapter
    OleDbDataAdapter objDataAdapter = new OleDbDataAdapter();   
    string query;
    grdViewUserIDs.DataSource = "";
    try
    {
        objXConn.Open();
        query = "select * from [Sheet1$]";
        OleDbCommand objCommand = new OleDbCommand(query, objXConn);
        objDataAdapter.SelectCommand = objCommand;
        // Create a DataSet
        DataSet objDataSet = new DataSet();
        // Populate the DataSet with the spreadsheet worksheet data
        objDataAdapter.Fill(objDataSet);
        // Bind the data to the GridView
        grdViewUserIDs.DataSource = objDataSet.Tables[0].DefaultView;
        grdViewUserIDs.DataBind();
        query = "";
        objDataSet.Clear();
    }
    catch (Exception ex)
    {
        string t;
        t = ex.ToString();                    
    }
    finally
    { 
		objXConn.Close();
	}         
}



In the above code, how to replace [Sheet1$] with the current excel sheet name ?
suchita

AnswerRe: getting excel sheet current sheet name in asp.net Pin
#realJSOP19-Apr-11 7:20
professional#realJSOP19-Apr-11 7:20 
GeneralRe: getting excel sheet current sheet name in asp.net Pin
Dhyanga19-Apr-11 9:12
Dhyanga19-Apr-11 9:12 
AnswerRe: getting excel sheet current sheet name in asp.net Pin
Tarakeshwar Reddy19-Apr-11 8:11
professionalTarakeshwar Reddy19-Apr-11 8:11 
QuestionFileUpload.HasFile properties is not within UpdatePanel but still alway return false [modified] Pin
Ne7ven18-Apr-11 5:36
Ne7ven18-Apr-11 5:36 
AnswerRe: FileUpload.HasFile properties is not within UpdatePanel but still alway return false Pin
Prasanta_Prince18-Apr-11 7:25
Prasanta_Prince18-Apr-11 7:25 
GeneralRe: FileUpload.HasFile properties is not within UpdatePanel but still alway return false Pin
Ne7ven19-Apr-11 19:35
Ne7ven19-Apr-11 19:35 
QuestionHuge Xml Document(more than 10GB) import to Sql Server 2005 [modified] Pin
ntiin17-Apr-11 21:48
ntiin17-Apr-11 21:48 
AnswerRe: Huge Xml Document(more than 10GB) import to Sql Server 2005 Pin
Ravi Sant18-Apr-11 1:16
Ravi Sant18-Apr-11 1:16 
AnswerRe: Huge Xml Document(more than 10GB) import to Sql Server 2005 Pin
Not Active18-Apr-11 8:38
mentorNot Active18-Apr-11 8:38 
Questionsql server 2005 connection error Pin
Ramkumar_S17-Apr-11 17:37
Ramkumar_S17-Apr-11 17:37 
AnswerRe: sql server 2005 connection error Pin
Bernhard Hiller17-Apr-11 20:42
Bernhard Hiller17-Apr-11 20:42 
AnswerRe: sql server 2005 connection error Pin
Ravi Sant18-Apr-11 1:28
Ravi Sant18-Apr-11 1:28 
AnswerRe: sql server 2005 connection error Pin
Prasanta_Prince19-Apr-11 6:42
Prasanta_Prince19-Apr-11 6:42 
QuestionCall a given URL after every specific time Interval Pin
Member 455876517-Apr-11 17:30
Member 455876517-Apr-11 17:30 
AnswerRe: Call a given URL after every specific time Interval Pin
Ramkumar_S18-Apr-11 0:27
Ramkumar_S18-Apr-11 0:27 
AnswerRe: Call a given URL after every specific time Interval Pin
Ravi Sant18-Apr-11 1:22
Ravi Sant18-Apr-11 1:22 
QuestionHow to get client machine ID? Pin
Prasanta_Prince17-Apr-11 5:44
Prasanta_Prince17-Apr-11 5:44 

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.