G
Guest
How do I iterate through a dataset and add the rows to a word document? I
have the following:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim oApp = New Word.Application
Dim oMainDoc = oApp.ActiveDocument
Dim Cust_id As String
Cust_id = "select * from filename where Customer_id=2"
Me.MySqlConnection1.Open()
Me.MySqlCommand1.CommandText = Cust_id
Me.MySqlDataAdapter1.Fill(DataSet31)
Dim oPara1 = oMainDoc.Content.Paragraphs.Add
Dim drDetails As DataRow
For Each drDetails In DataSet3
oPara1 = oPara1 & drDetails.GetParentRows
Next
Me.MySqlConnection1.Close()
End Sub
have the following:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim oApp = New Word.Application
Dim oMainDoc = oApp.ActiveDocument
Dim Cust_id As String
Cust_id = "select * from filename where Customer_id=2"
Me.MySqlConnection1.Open()
Me.MySqlCommand1.CommandText = Cust_id
Me.MySqlDataAdapter1.Fill(DataSet31)
Dim oPara1 = oMainDoc.Content.Paragraphs.Add
Dim drDetails As DataRow
For Each drDetails In DataSet3
oPara1 = oPara1 & drDetails.GetParentRows
Next
Me.MySqlConnection1.Close()
End Sub