?
Solved

need to start table dump on row 8 column A

Posted on 2008-06-18
5
Medium Priority
?
216 Views
Last Modified: 2013-11-26
Hi!

I want to add a company jpg on column a row 1 and title. Therefore I need to start my dataset dump on row 8 and comlumn A.

The code I have now looks like this:



How do i modify accordingly?

THanks!

Tammy
If CheckBox1.CheckState = CheckState.Checked Then
 
 
                    connectionString2 = "data source='" & ComboServers.Text & "'; Initial catalog=master;Integrated Security = True;"
                    cnn2 = New SqlConnection(connectionString2)
                    cnn2.Open()
                    sql2 = "Select * from master.dbo.temp_Filter_by_error where [Error Description] in ('Could not index file') order by [fileset ID],[Doc ID]"
                    Dim dscmd2 As New SqlDataAdapter(sql2, cnn2)
                    Dim ds2 As New DataSet
                    dscmd2.Fill(ds2)
 
 
                    .Worksheets(3).Select()
 
 
                    CType(Excel.Workbooks(1).Worksheets("Sheet3"), Microsoft.Office.Interop.Excel.Worksheet).Name = "Index Error Report"
 
                    Dim m As Integer = 1
                    For col = 0 To ds2.Tables(0).Columns.Count - 1
                        .cells(1, m).value = ds2.Tables(0).Columns(col).ColumnName
                        .cells(1, m).EntireRow.Font.Bold = True
                        m += 1
                    Next
                    m = 2
                    Dim n As Integer = 1
                    For col = 0 To ds2.Tables(0).Columns.Count - 1
                        m = 2
                        For row = 0 To ds2.Tables(0).Rows.Count - 1
                            .Cells(m, n).Value = ds2.Tables(0).Rows(row).ItemArray(col)
                            m += 1
                        Next
                        n += 1
                    Next
 
 
                End If

Open in new window

0
Comment
Question by:jtammyg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 39

Expert Comment

by:nutsch
ID: 21818592
Change line 18 to
                    Dim m As Integer = 8
and line 24 to
m=9
0
 

Author Comment

by:jtammyg
ID: 21818752
That's not what i need.

I need to dump the data in row 8......not column 8

Thanks!

Tammy
0
 
LVL 39

Accepted Solution

by:
nutsch earned 400 total points
ID: 21818804
My apologies, I got confused since the code uses m as a row once, then as a column. Here is the updated code from line 18 to 33
                    Dim m As Integer = 1
                    For col = 0 To ds2.Tables(0).Columns.Count - 1
                        .cells(8, m).value = ds2.Tables(0).Columns(col).ColumnName
                        .cells(8, m).EntireRow.Font.Bold = True
                        m += 1
                    Next
                    m = 9
                    Dim n As Integer = 1
                    For col = 0 To ds2.Tables(0).Columns.Count - 1
                        m = 9
                        For row = 0 To ds2.Tables(0).Rows.Count - 1
                            .Cells(m, n).Value = ds2.Tables(0).Rows(row).ItemArray(col)
                            m += 1
                        Next
                        n += 1
                    Next

Open in new window

0
 

Author Comment

by:jtammyg
ID: 21818880
Thank you so much Nutsch!!!!!

works perfect :-)
0
 
LVL 39

Expert Comment

by:nutsch
ID: 21819469
Glad to help.

Thomas
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question