Click here to Skip to main content
15,914,162 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralCheck syntax of a function Pin
Waheed Ur Rehman11-Mar-08 20:58
Waheed Ur Rehman11-Mar-08 20:58 
GeneralRe: Check syntax of a function Pin
danasegaranea11-Mar-08 21:04
danasegaranea11-Mar-08 21:04 
GeneralRe: Check syntax of a function Pin
N a v a n e e t h11-Mar-08 21:13
N a v a n e e t h11-Mar-08 21:13 
GeneralRe: Check syntax of a function Pin
Waheed Ur Rehman11-Mar-08 23:04
Waheed Ur Rehman11-Mar-08 23:04 
GeneralRe: Check syntax of a function Pin
N a v a n e e t h11-Mar-08 23:23
N a v a n e e t h11-Mar-08 23:23 
GeneralRe: Check syntax of a function Pin
Waheed Ur Rehman11-Mar-08 23:31
Waheed Ur Rehman11-Mar-08 23:31 
GeneralRe: Check syntax of a function Pin
N a v a n e e t h12-Mar-08 0:04
N a v a n e e t h12-Mar-08 0:04 
GeneralImporting Data from Excel sheet to the Database Pin
Member 464849111-Mar-08 20:56
Member 464849111-Mar-08 20:56 
Hi...
I am developing a project called Info Dial....I got stuck at a place where i have to store an excel sheet into a database that can be displayed in a grid view....thats working fine for a single Excel sheet...but what if i have more than one excel shhets Frown | :( ??How can i overcome this problem?

I have my code as shown....

if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.ContentLength > 0)
{
string fn = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
string savelocation = @"D:\programs\" + fn;
FileUpload1.PostedFile.SaveAs(savelocation);
string excelConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + savelocation + ";" + "Extended Properties=Excel 8.0;");

// Create Connection to Excel Workbook
OleDbConnection connection = new OleDbConnection(excelConnectionString);
OleDbCommand command = new OleDbCommand("Select * FROM [Sheet1$]", connection);
connection.Open();
// Create DbDataReader to Data Worksheet
System.Data.OleDb.OleDbDataReader dr = command.ExecuteReader();
// SQL Server Connection String
string sqlConnectionString = "Database=Infodial;server=s156;uid=sa;pwd=sa";

// Bulk Copy to SQL Server
SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString);
bulkCopy.DestinationTableName = "companydetails";
bulkCopy.WriteToServer(dr);
connection.Close();
ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", "<script>alert('Saved in Database Successfully');</script>", false);
}


Any code would be appreciated...
Thanks in Advance
Regards
Abhishek.
GeneralInvalid Charcter Pin
danasegaranea11-Mar-08 20:50
danasegaranea11-Mar-08 20:50 
GeneralRe: Invalid Charcter Pin
N a v a n e e t h11-Mar-08 20:59
N a v a n e e t h11-Mar-08 20:59 
GeneralRe: Invalid Charcter Pin
danasegaranea11-Mar-08 21:06
danasegaranea11-Mar-08 21:06 
GeneralRe: Invalid Charcter Pin
N a v a n e e t h11-Mar-08 21:10
N a v a n e e t h11-Mar-08 21:10 
GeneralRe: Invalid Charcter Pin
Trishul Tandel11-Mar-08 21:27
Trishul Tandel11-Mar-08 21:27 
GeneralRe: Invalid Charcter Pin
danasegaranea11-Mar-08 22:41
danasegaranea11-Mar-08 22:41 
GeneralRe: Invalid Charcter Pin
Trishul Tandel11-Mar-08 22:48
Trishul Tandel11-Mar-08 22:48 
GeneralRe: Invalid Charcter Pin
danasegaranea11-Mar-08 22:57
danasegaranea11-Mar-08 22:57 
GeneralRe: Invalid Charcter Pin
Trishul Tandel11-Mar-08 23:10
Trishul Tandel11-Mar-08 23:10 
GeneralApplying Styles to asp:button Pin
danasegaranea11-Mar-08 20:38
danasegaranea11-Mar-08 20:38 
GeneralRe: Applying Styles to asp:button Pin
Trishul Tandel11-Mar-08 20:43
Trishul Tandel11-Mar-08 20:43 
GeneralRe: Applying Styles to asp:button Pin
danasegaranea11-Mar-08 20:47
danasegaranea11-Mar-08 20:47 
GeneralRe: Applying Styles to asp:button Pin
Trishul Tandel11-Mar-08 21:06
Trishul Tandel11-Mar-08 21:06 
GeneralRe: Applying Styles to asp:button Pin
danasegaranea11-Mar-08 21:08
danasegaranea11-Mar-08 21:08 
GeneralRe: Applying Styles to asp:button Pin
Trishul Tandel11-Mar-08 21:12
Trishul Tandel11-Mar-08 21:12 
GeneralIntroduction to Design Patterns Pin
Satish - Developer11-Mar-08 20:38
Satish - Developer11-Mar-08 20:38 
GeneralRe: Introduction to Design Patterns Pin
N a v a n e e t h11-Mar-08 20:56
N a v a n e e t h11-Mar-08 20:56 

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.