Varshini S
asked on
How to assign object values to datatable in vb.net ?
Here is my vb.code. i want to loop through object svalue and assign values to datatable. How to do this ?
Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
string workbookPath = @"c:\temp\SomeWorkBook.xlsx";
xlApp = new Excel.Application();
xlWorkBook = xlApp.Workbooks.Open(workbookPath , Type.Missing, false, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
xlApp.Visible = false;
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
object svalue = xlWorkSheet.UsedRange.Value2;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
System.Data.OleDb.OleDbCon nection cnn = new System.Data.OleDb.OleDbCon nection(@"provider=Microsoft.ACE.O LEDB.12.0; Data Source='C:\Temp\SomeWorkBo ok.xlsx';E xtended Properties=Excel 8.0;");
You syntax is slightly incorrect. Try this.
You syntax is slightly incorrect. Try this.
ASKER
i have converted your code vb.net. But it showing an below error when executing following line
System.Data.OleDb.OleDbCon
Error: Format of the initialization string does not conform to specification starting at index 34.
My Code:
Open in new window