Result sets question on Dot Net provider

Connectivity
Enthusiast

Result sets question on Dot Net provider

I am getting a around 200/500 lines of query results that is DDLs etc returned from my dot net query.  It works on SQL assistant okay. When I send it using the below query I only get the first DDL and not other DDLs.

Any idea, if this is a limitation or any setting that I need to take a look?

Here is my code:

 Dim pf As DbProviderFactory = DbProviderFactories.GetFactory("Teradata.Client.Provider")

                Dim con As DbConnection = pf.CreateConnection()

                Dim sConnection As [String] = "Data Source=" + Constants.sDataSource + ";User ID=" + Constants.sUser + ";Password=" + Constants.sPassword

                con.ConnectionString = sConnection

                '                MsgBox(con.ConnectionString)

                con.Open()

                Try

                    Dim cmd As DbCommand = pf.CreateCommand()

                    Dim ds As New DataSet()

-----

Here is how I am handling:

 Try

                            Dim rowCount As Integer = 0

                            Dim charData As String

                            If reader.HasRows Then

                                While reader.Read()

                                    rowCount += 1

                                    charData = reader.GetString(0)

                                    Dim DatabaseName As String = charData

                                    dbMessage.Text = charData.Trim

                                End While

                            End If

Tags (2)
2 REPLIES
Teradata Employee

Re: Result sets question on Dot Net provider

The results are probably returned as separate result sets so you will need to call NextResult() and loop through all future result sets as well as the first one.

(apparently some code is omitted/extra here as you appear to be referencing both a DataSet AND a DataReader ... which are alternatives.)

Enthusiast

Re: Result sets question on Dot Net provider

Mike, Many thanks!

That worked lke a charm....!!!!

I had to use the nextResult within my loop and concatinate it with vbCrLf something like this:

  'Add to my Rich Textbox now

                                        dbMessage.Text = dbMessage.Text & vbCrLf & charData.Trim & vbCrLf

                                    End While

                                    reader.NextResult()

                                Loop

I am able to get what I wanted, at the end.  

--Regards,