Click here to Skip to main content
15,890,579 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionWeb Parts Personalization Reset problem Pin
Richard Lund24-May-10 3:11
Richard Lund24-May-10 3:11 
QuestionIframe reload Pin
siva45524-May-10 2:49
siva45524-May-10 2:49 
QuestionPlease help me.......MIME Type for XLS file Pin
cheguri24-May-10 0:02
cheguri24-May-10 0:02 
AnswerRe: Please help me.......MIME Type for XLS file Pin
Sandeep Mewara24-May-10 3:09
mveSandeep Mewara24-May-10 3:09 
QuestionChat with webcams Pin
rainyboy123-May-10 23:14
rainyboy123-May-10 23:14 
AnswerRe: Chat with webcams Pin
Brij24-May-10 1:29
mentorBrij24-May-10 1:29 
QuestionHow to upload Excel file to Database from ASP.NET Pin
cheguri23-May-10 22:41
cheguri23-May-10 22:41 
AnswerRe: How to upload Excel file to Database from ASP.NET Pin
Gaurav Dudeja India23-May-10 23:02
Gaurav Dudeja India23-May-10 23:02 
use this function

public static DataTable GetDataTableFromExcel(string SourceFilePath)
{
    string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                                                        "Data Source=" + SourceFilePath + ";" +
                                                        "Extended Properties=Excel 8.0;";

    using (OleDbConnection cn = new OleDbConnection(ConnectionString))
    {
        cn.Open();

        DataTable dbSchema = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
        if (dbSchema == null || dbSchema.Rows.Count < 1)
        {
                throw new Exception("Error: Could not determine the name of the first worksheet.");
        }

        string WorkSheetName = dbSchema.Rows[0]["TABLE_NAME"].ToString();

        OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM [" + WorkSheetName + "]", cn);
        DataTable dt = new DataTable(WorkSheetName);

        da.Fill(dt);

        return dt;
    }
}


This will return you datatable after that with the help of loop insert it into database
Gaurav Dudeja
http://www.gdinfotechindia.com

Dont be afraid of changing your life to better !

QuestionConsole application with Asp.Net Project Pin
slSoftware23-May-10 22:31
slSoftware23-May-10 22:31 
AnswerRe: Console application with Asp.Net Project Pin
Not Active24-May-10 1:52
mentorNot Active24-May-10 1:52 
GeneralRe: Console application with Asp.Net Project Pin
slSoftware24-May-10 1:56
slSoftware24-May-10 1:56 
GeneralRe: Console application with Asp.Net Project Pin
Not Active24-May-10 2:24
mentorNot Active24-May-10 2:24 
GeneralRe: Console application with Asp.Net Project Pin
slSoftware24-May-10 2:32
slSoftware24-May-10 2:32 
GeneralRe: Console application with Asp.Net Project Pin
Not Active24-May-10 3:02
mentorNot Active24-May-10 3:02 
QuestionHow to Display Confirmation Dialog Box Pin
cheguri23-May-10 21:18
cheguri23-May-10 21:18 
AnswerRe: How to Display Confirmation Dialog Box Pin
Dinesh Mani23-May-10 21:46
Dinesh Mani23-May-10 21:46 
QuestionenableEventValidation in IE Pin
sudheesh kumar s23-May-10 21:07
sudheesh kumar s23-May-10 21:07 
QuestionCustom error configuration setting Pin
A M SOMAN23-May-10 19:24
A M SOMAN23-May-10 19:24 
QuestionDo I need to issue Http Code 301 when I use Response.Redirect ? Pin
Nadia Monalisa23-May-10 18:59
Nadia Monalisa23-May-10 18:59 
AnswerRe: Do I need to issue Http Code 301 when I use Response.Redirect ? Pin
Yusuf23-May-10 19:16
Yusuf23-May-10 19:16 
GeneralRe: Do I need to issue Http Code 301 when I use Response.Redirect ? Pin
Nadia Monalisa23-May-10 20:19
Nadia Monalisa23-May-10 20:19 
GeneralRe: Do I need to issue Http Code 301 when I use Response.Redirect ? Pin
Not Active24-May-10 1:49
mentorNot Active24-May-10 1:49 
Questioncustom AjaxEditorControl Pin
jitendrafaye23-May-10 18:35
jitendrafaye23-May-10 18:35 
AnswerRe: custom AjaxEditorControl Pin
barby.barby21-Feb-11 19:49
barby.barby21-Feb-11 19:49 
QuestionDynamic Table Row creation Pin
dwadasi23-May-10 18:29
dwadasi23-May-10 18:29 

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.