How do i attach schema.ini file to get complete data

Deepak Talwar

New Member
Joined
Dec 15, 2014
Messages
1
I want to import XLSX file in SQL database. i am using following C# code.
in one column I have data of more than 255 characters. While reading records in Dataset it pick data up to 255 characters only


<code style="margin: 0px; padding: 0px; border: 0px; font-size: 13.63636302947998px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">OleDbConnection odconn = null

String file = sample.xlsx

odconn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + file + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1;\";");



odconn.Open();

dtCol = oconn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);

string strSheetName = dtCol.Rows[0]["TABLE_NAME"].ToString();

odconn.Close();



odconn.Open();

OleDbDataAdapter oleda = new OleDbDataAdapter("select * from [" + strSheetName + "]", odconn);oleda.Fill(ds);

odconn.Close();</code>
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,472
Messages
6,125,005
Members
449,203
Latest member
Daymo66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top