cancel
Showing results for 
Search instead for 
Did you mean: 

valid name error

03-13-2013 3:26 PM
195 views 3 comments
0 Likes
SAP Managed Tags
Subscribe

Hi

  In the below code , it is giving me error [Temp$] is not Valid Name .

Dim cnn As String

        cnn = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp.XLS;Extended Properties=Excel 8.0")

        Dim ds As New DataSet

        Dim dt As New DataTable

        Dim excelcnn As New System.Data.OleDb.OleDbConnection(cnn)

        Dim excelqry As String

        excelqry = "Select * from [TEMP$]"

Thanks

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Hi

TEMP  should be your Sheet Name.

Dim Con_Str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & path & ";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"

con.ConnectionString = Con_Str

If (con.State = ConnectionState.Open) Then con.Close()

                                    con.Open()

Dim DA As New OleDb.OleDbDataAdapter("SELECT * FROM [TEMP$]", con)

                                   

Dim Dt As New DataSet

                                    DA.Fill(Dt)

Regards

Parthiban

Former Member
0 Likes

Hi

   Below code is neither giving me any error nor creating any J.E . is the code right . I want to create single J.E

While (excelreader.Read())

            i = i + 1

            Dim strpartyCode = excelreader.GetValue(0).ToString()

            Dim strAcctCode = excelreader.GetValue(1).ToString()

            Dim strCredit = excelreader.GetValue(2).ToString()

            Dim strDebit = excelreader.GetValue(3).ToString()

            Dim strText = excelreader.GetValue(4).ToString()

            oJE.TaxDate = Date.Today

            oJE.ReferenceDate = Date.Today

             oJE.Lines.Credit = dblcredit

            oJE.Lines.Debit = dblDebit

            oJE.Lines.LineMemo = strText

            oJE.Lines.AccountCode = strAcctCode

            oJE.Lines.Add()

        End While

Thanks

AdKerremans
Active Contributor
0 Likes

Hi Sunny,

you forget to add the JournalEntry

the oJe.Add()

Regards

Ad