开发者

Generate DateRow for every row in a dataset

开发者 https://www.devze.com 2023-02-05 16:59 出处:网络
Dim diaryreader As SqlDataReader diarycmd.CommandText = \"dashboardusers\" diarycmd.CommandType = CommandType.StoredProcedure
Dim diaryreader As SqlDataReader

diarycmd.CommandText = "dashboardusers"
diarycmd.CommandType = CommandType.StoredProcedure
diarycmd.Connection = usersconn
diaryconn.Open()
diaryreader = diarycmd.ExecuteReader()

Dim diaryTable As DataTable = New DataTable()

diaryTable.Load(diaryreader)


Dim dr As DataRow
for each (dr in diaryTable.rows)
Next

This is not working, I 开发者_如何转开发am getting a syntax error when i try to do for each dr in diarytable.rows


You get errors because your braces are set wrong. This would work:

Dim dr As DataRow
For Each dr In diaryTable.Rows
Next


why don't you use data table instead ? you will just have to iterate through the table

foreach(DataRow dr in ds.Tables[0].Rows)...


ds.Tables(0).Rows.Count retrieves the number of rows available in the DataTable. Then you can simply iterate over that count.

0

精彩评论

暂无评论...
验证码 换一张
取 消