关于更新数据表MyDT
,我有一个小问题。我用谷歌搜索并发现了几种方法并得到了编译错误。这是代码,这是我尝试的错误。任何帮助是极大的赞赏。顺便说一句,我使用的是asp.net framework 2.0和VB.NET
MyDT.Rows[1][4] = "4NF" ' Property access must assign to the property or use it value
row.Item("New_Column") = "4NF" ' Input string was not in a correct format.
无法存储< 4NF>在New_Column专栏中。期望类型是字节。
row["New_Column"] = "4NF" ' Expression is not a method
Dim StatusCode As String
For Each row As DataRow In MyDT.Rows
StatusCode= row.Item("ThisColumn").ToString()
If StatusCode= "NONF" Then
MyDT.Rows[1][4] = "4NF"
End If
Next row
答案 0 :(得分:-1)
你应该:
转化看起来如何
MyDT.Rows[1][4] = Convert.ToByte("4NF")