Click here to Skip to main content
11,642,402 members (63,392 online)

Web Development

 
QuestionProblem with Knockout mapping of observable array. Pin
Packer L18-May-12 0:04
memberPacker L18-May-12 0:04 
AnswerRe: Problem with Knockout mapping of observable array. Pin
Packer L18-May-12 20:07
memberPacker L18-May-12 20:07 
Questionhow can i bind data from excel file? Pin
heinhtataung16-May-12 23:09
memberheinhtataung16-May-12 23:09 
AnswerRe: how can i bind data from excel file? Pin
Mickt198519-May-12 21:36
memberMickt198519-May-12 21:36 
Hey they are 2 ways which you can achieve this. You can get the cell range and store it in an array and then read the values from the array like so :
this.openFileDialog1.FileName = "*.xls";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open(
openFileDialog1.FileName, 0, true, 5,
"", "", true, Excel.XlPlatform.xlWindows, "\t", false, false,
0, true);
Excel.Sheets sheets = theWorkbook.Worksheets;
Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1);
for (int i = 1; i <= 10; i++)
{
Excel.Range range = worksheet.get_Range("A"+i.ToString(), "J" + i.ToString());
System.Array myvalues = (System.Array)range.Cells.Value;
string[] strArray = ConvertToStringArray(myvalues);
TextBox.Text = strArray[0].ToString();
}
}
or you could use OleDb like so assuming you have a sheet in the excel file called MyObject :
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book1.xls;Extended Properties=Excel 8.0");
OleDbDataAdapter da = new OleDbDataAdapter("select * from MyObject", con);
DataTable dt = new DataTable();
da.Fill(dt);

Hope this helps


AnswerRe: how can i bind data from excel file? Pin
Mickt198525-May-12 11:08
memberMickt198525-May-12 11:08 
QuestionUse of Session states in SharePoint 2010 Pin
Athar Raza Faridi16-May-12 20:37
memberAthar Raza Faridi16-May-12 20:37 
QuestionMessage box with 3 buttons Yes/NO/Cancel in ASP.Net Pin
berba16-May-12 3:15
memberberba16-May-12 3:15 
AnswerRe: Message box with 3 buttons Yes/NO/Cancel in ASP.Net Pin
Sandeep Mewara16-May-12 7:38
mvpSandeep Mewara16-May-12 7:38 
QuestionEmails Sent by Window Service/C# Code are landing in spam in Gmail Pin
masterprogrammertech14-May-12 1:19
membermasterprogrammertech14-May-12 1:19 
AnswerRe: Emails Sent by Window Service/C# Code are landing in spam in Gmail Pin
Bernhard Hiller14-May-12 21:36
memberBernhard Hiller14-May-12 21:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 1 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid