Thanks all for your replies. Basically, I have a sql table that contains
columns of column names for other tables. Col1 may contain 90 rows where
each cell contains column names for tbl1, Col2 contains 40 rows of not null
data for the columns in tbl2, ...
I am using a datareader to read the not null values in each column
individually, and I loop through the datareader to add sqlInsertCommand
Params (for my Insert SP in sql server which has the same number of params).
So I am stuck with using
i += 1 '--i is the column ordincal for tlb1 and tbl2 and the row in the
columnNames
'--table
'--rdr reads the rows in the ColumnNames table
While rdr.Read
str1 = rdr.GetString(0)
'--this is a Text field for tbl1 and tbl2
If ((stp = "cd" Or stp = "qa") And i = 2) Or (stp = "qa" And i = 8) Then
cmdNcalInsert.Parameters.Add(str1, SqlDbType.NText, 16,
str1.Substring(1, str1.Length - 1))
ElseIf str1 = "@RowNum" Then
cmdNcalInsert.Parameters.Add(str1, SqlDbType.Int, 4, str1.Substring(1,
str1.Length - 1))
Else
cmdNcalInsert.Parameters.Add(str1, SqlDbType.NVarChar, 20,
str1.Substring(1, str1.Length - 1))
End If
i += 1
End While
"Rich" wrote:
Is there any builtin functionality to the SqlDataReader for getting a row
count of records retrieved? Rather than Do While rdr.Read: i+=1: Loop?