[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

How can I use MaxScanRows in C# source code to import the excel sh

Manoj Kumar Goud

10/12/2006 6:06:00 AM

when i imported excel sheet to datagrid some of values are ignored.If i
change the TypeGuessRows registry key value in path
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines to 0 then its working
fine .But it is not the right way to change the registry key.So I followed
alternative way.I used MaxScanRows in my source code .But it has no
effect.Can anyone please help me about this problem.Is there any way how to
use MaxScanRows property, so that it will work fine.I tried in different way
like MaxScanRows=0/MaxScanRows=FFFFFFFF but no effect.Please help me out so
that I ll be glad to u.
4 Answers

Paul Clement

10/12/2006 4:16:00 PM

0

On Wed, 11 Oct 2006 23:06:02 -0700, Manoj Kumar Goud <Manoj Kumar Goud@discussions.microsoft.com>
wrote:

&#164; when i imported excel sheet to datagrid some of values are ignored.If i
&#164; change the TypeGuessRows registry key value in path
&#164; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines to 0 then its working
&#164; fine .But it is not the right way to change the registry key.So I followed
&#164; alternative way.I used MaxScanRows in my source code .But it has no
&#164; effect.Can anyone please help me about this problem.Is there any way how to
&#164; use MaxScanRows property, so that it will work fine.I tried in different way
&#164; like MaxScanRows=0/MaxScanRows=FFFFFFFF but no effect.Please help me out so
&#164; that I ll be glad to u.

Try specifying the IMEX argument:

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=e:\\My Documents\\Book2.xls;" +
"Extended Properties=" + (char)34 + "Excel 8.0;HDR=Yes;IMEX=1;" + (char)34;


Paul
~~~~
Microsoft MVP (Visual Basic)

Manoj Kumar Goud

10/13/2006 3:48:00 AM

0

Hi Paul,
thanks for giving some tips.I also used IMEX=1 but no result.Please see my
string what I used in my program.

private const string EXCEL_CONNECTION_STRING_1 =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";

private const string EXCEL_CONNECTION_STRING_2 = ";Extended
Properties=\"Excel 8.0;;HDR=No;MaxScanRows=0;IMEX=1\"";

Is there any other changes in this string

Regards,
Manoj

"Paul Clement" wrote:

> On Wed, 11 Oct 2006 23:06:02 -0700, Manoj Kumar Goud <Manoj Kumar Goud@discussions.microsoft.com>
> wrote:
>
> &#194;&#164; when i imported excel sheet to datagrid some of values are ignored.If i
> &#194;&#164; change the TypeGuessRows registry key value in path
> &#194;&#164; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines to 0 then its working
> &#194;&#164; fine .But it is not the right way to change the registry key.So I followed
> &#194;&#164; alternative way.I used MaxScanRows in my source code .But it has no
> &#194;&#164; effect.Can anyone please help me about this problem.Is there any way how to
> &#194;&#164; use MaxScanRows property, so that it will work fine.I tried in different way
> &#194;&#164; like MaxScanRows=0/MaxScanRows=FFFFFFFF but no effect.Please help me out so
> &#194;&#164; that I ll be glad to u.
>
> Try specifying the IMEX argument:
>
> ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
> "Data Source=e:\\My Documents\\Book2.xls;" +
> "Extended Properties=" + (char)34 + "Excel 8.0;HDR=Yes;IMEX=1;" + (char)34;
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)
>

Manoj Kumar Goud

10/13/2006 3:51:00 AM

0

Hi Paul,
Thanks for giving some tips.I also used IMEX=1 still no effect.Please see my
connection string

private const string EXCEL_CONNECTION_STRING_1 =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";

private const string EXCEL_CONNECTION_STRING_2 = ";Extended
Properties=\"Excel 8.0;;HDR=No;MaxScanRows=0;IMEX=1\"";

Is there any modification or other property ,I have to add to work properly
Thanks

"Paul Clement" wrote:

> On Wed, 11 Oct 2006 23:06:02 -0700, Manoj Kumar Goud <Manoj Kumar Goud@discussions.microsoft.com>
> wrote:
>
> &#194;&#164; when i imported excel sheet to datagrid some of values are ignored.If i
> &#194;&#164; change the TypeGuessRows registry key value in path
> &#194;&#164; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines to 0 then its working
> &#194;&#164; fine .But it is not the right way to change the registry key.So I followed
> &#194;&#164; alternative way.I used MaxScanRows in my source code .But it has no
> &#194;&#164; effect.Can anyone please help me about this problem.Is there any way how to
> &#194;&#164; use MaxScanRows property, so that it will work fine.I tried in different way
> &#194;&#164; like MaxScanRows=0/MaxScanRows=FFFFFFFF but no effect.Please help me out so
> &#194;&#164; that I ll be glad to u.
>
> Try specifying the IMEX argument:
>
> ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
> "Data Source=e:\\My Documents\\Book2.xls;" +
> "Extended Properties=" + (char)34 + "Excel 8.0;HDR=Yes;IMEX=1;" + (char)34;
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)
>

Sharique

8/7/2009 12:51:00 AM

0

Setting "MaxScanRows=0" is the ''correct'' way to address this problem.
But this connection string property is ignored/not implemented in Jet 4.0

See the MS Knowledge base:

"http://support.microsoft.com/kb/189897/EN...

There is a workaround (as noted above):

You have to change a registry key to the correct zero value, but note that you will see a performance hit as the full table will be scanned.

The Excel ODBC driver uses the TypeGuessRows DWORD value of one of the following registry key to determine how many rows to scan in your data:

* Excel 97
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\3.5\Engines\Excel
* Excel 2000 and later versions
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel

Set the value to Zero.


From http://www.development...22_2006_10_0_0_833712/How-can-I-use-MaxScanRows-in-C-source-code-to-import-the-ex...

Posted via DevelopmentNow.com Groups
http://www.development...