Page 1 of 1

excel sheet name is displayed as jr_page_anchor_0_1

Posted: Tue Apr 19, 2016 8:42 pm
by vivek.guvva
Hi,

I am trying to import data from excel sheet to data table. Below code worked last week and I was able to import data from excel to data table. But when I try today, It is nor retrieving correct sheet name. Sheet name is displayed as "JR_PAGE_ANCHOR_0_1". Please help me in resolving the issue. Below is the code I am using.


strxlconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & UIFile & ";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
Dim xlconn as System.Data.OleDb.OleDbConnection = new System.Data.OleDb.OleDbConnection(strxlconn)
xlconn.Open
Dim dtTablelist as System.Data.DataTable = xlconn.GetSchema("Tables")
UIDataDT = New System.Data.DataTable()

If dtTablelist.Rows.Count > 0 Then
sheetname = dtTablelist.Rows(0)("TABLE_NAME").ToString
System.Console.WriteLine ("First Sheet name is: " & sheetname )
report.Log(reportlevel.Info, "Sheet name is " & sheetname)
End If

If sheetname <> "" Then
xlcmd = New OleDbCommand("select * from [" & sheetname & "]", xlconn)
xladp = New OleDbDataAdapter(xlcmd)
xladp.Fill(UIDataDT)
System.Console.WriteLine("UI Data loaded into data table")
uirowcount = UIDataDT.Rows.Count.ToString
System.Console.WriteLine("Number of rows in UI data tableis " & uirowcount)
uicolcount = UIDataDT.Columns.Count.ToString
System.Console.WriteLine("Number of columns in UI data tableis " & uicolcount)
xlconn.Close
report.Log(reportlevel.Info, "UI Data loaded into data table")
report.Log(reportlevel.Info, "Number of rows in UI data table is " & uirowcount)
End If



Thanks
Vivek

Re: excel sheet name is displayed as jr_page_anchor_0_1

Posted: Tue Apr 19, 2016 9:18 pm
by krstcs
If it worked last week, then what changed between now and then? That is probably what is causing the issue.

Look in your version control system and you should be able to see what changed. That should give you a pretty good clue as to what to fix.