Click here to Skip to main content
15,923,142 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VB.Net 2005 And Databinding Pin
pmarfleet31-Jan-08 8:51
pmarfleet31-Jan-08 8:51 
GeneralRe: VB.Net 2005 And Databinding Pin
Steven J Jowett31-Jan-08 8:52
Steven J Jowett31-Jan-08 8:52 
QuestionStack Overflow when adding controls across threads. Pin
Chinners30-Jan-08 23:25
Chinners30-Jan-08 23:25 
GeneralRe: Stack Overflow when adding controls across threads. Pin
m@u30-Jan-08 23:48
m@u30-Jan-08 23:48 
GeneralRe: Stack Overflow when adding controls across threads. Pin
Chinners31-Jan-08 0:16
Chinners31-Jan-08 0:16 
GeneralRe: Stack Overflow when adding controls across threads. Pin
m@u31-Jan-08 0:22
m@u31-Jan-08 0:22 
AnswerRe: Stack Overflow when adding controls across threads. Pin
Chinners31-Jan-08 0:31
Chinners31-Jan-08 0:31 
GeneralProblem with Excel Sheet name when importing using oledb Pin
RichardBerry30-Jan-08 21:28
RichardBerry30-Jan-08 21:28 
Hi

Using VS2005 VB

I am having Problems when importing data from an Excel sheet using oledb

The sheets being opened as always use the following naming convention

P_W03-29M40MH-S16A-1235296-XFA-

The problem seems to be the dash at the end.

If I rename the sheet and replace the dash with an underscore, it works fine
I dont want to have to open the book first an rename the sheets every time.
The code below throws an error when cmd.Execute reader executes.
The error states:
System.Data.OleDb.OleDbException = {"The Microsoft Jet database engine could not find the object 'P_W03-29M40MH-S16A-1235296-XFA-$.A:A'.
Make sure the object exists and that you spell its name and the path name correctly."}

This is the code I am using:

      <br />
<br />
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
                        "Data Source=C:\myFile.xls;" & _<br />
                        "Extended Properties=""Excel 8.0;HDR=NO"""<br />
<br />
        Dim conn As New System.Data.OleDb.OleDbConnection(strConn)<br />
        conn.Open()<br />
       <br />
        Dim strSheet As String = "P_W03-29M40MH-S16A-1235296-XFA-"<br />
        Dim cmd As New System.Data.OleDb.OleDbCommand("Select * from [" & strSheet & "$A:A]", conn)<br />
        Dim rdr As OleDbDataReader = cmd.ExecuteReader

GeneralRe: Problem with Excel Sheet name when importing using oledb Pin
Johan Hakkesteegt31-Jan-08 0:47
Johan Hakkesteegt31-Jan-08 0:47 
GeneralRe: Problem with Excel Sheet name when importing using oledb Pin
RichardBerry31-Jan-08 3:58
RichardBerry31-Jan-08 3:58 
GeneralRe: Problem with Excel Sheet name when importing using oledb Pin
Johan Hakkesteegt31-Jan-08 20:30
Johan Hakkesteegt31-Jan-08 20:30 
GeneralRe: Problem with Excel Sheet name when importing using oledb Pin
RichardBerry1-Feb-08 0:50
RichardBerry1-Feb-08 0:50 
GeneralDeployment Problem Pin
SamRST30-Jan-08 21:21
SamRST30-Jan-08 21:21 
GeneralDay of the week combinations. [modified] Pin
Absenm30-Jan-08 20:45
Absenm30-Jan-08 20:45 
GeneralRe: Day of the week combinations. Pin
Mycroft Holmes30-Jan-08 21:55
professionalMycroft Holmes30-Jan-08 21:55 
QuestionDatagridview default style getting changed changes Pin
nishkarsh_k30-Jan-08 20:36
nishkarsh_k30-Jan-08 20:36 
GeneralRe: Datagridview default style getting changed changes Pin
Dave Kreskowiak31-Jan-08 4:46
mveDave Kreskowiak31-Jan-08 4:46 
GeneralRe: Datagridview default style getting changed changes Pin
nishkarsh_k31-Jan-08 19:48
nishkarsh_k31-Jan-08 19:48 
GeneralLock Folder Pin
Kumaran21cen30-Jan-08 19:43
Kumaran21cen30-Jan-08 19:43 
GeneralRe: Lock Folder Pin
Mycroft Holmes30-Jan-08 22:00
professionalMycroft Holmes30-Jan-08 22:00 
GeneralRe: Lock Folder Pin
Steven J Jowett30-Jan-08 23:28
Steven J Jowett30-Jan-08 23:28 
GeneralRe: Lock Folder Pin
Dave Kreskowiak31-Jan-08 4:45
mveDave Kreskowiak31-Jan-08 4:45 
Generalinstantiating object returns nothing Pin
rotsey30-Jan-08 18:01
rotsey30-Jan-08 18:01 
GeneralRe: instantiating object returns nothing Pin
Justin Perez31-Jan-08 3:08
Justin Perez31-Jan-08 3:08 
QuestionHow to use Adodc In Vb.net Pin
ejaz_pk30-Jan-08 8:02
ejaz_pk30-Jan-08 8:02 

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.