G
Guest
Hi,
I'm new to '.net'. I'm working in vb.net and have an error don't know the cause of or how I should go about debugging it.
Here is the code:
Dim dsNwind As New DataSet
Dim daProds As New SqlDataAdapter(cmdSelProds)
daProds.Fill(dsNwind, "Prods")
Dim drProd As DataRow
drProd = dsNwind.Tables("Prods").NewRow
drProd.Item("ProductId") = 1006
drProd.Item("Name") = "widget"
drProd.Item("Grams") = "11g"
drProd.Item("Percent") = 5
dsNwind.Tables("Prods").Rows.Add(drProd)
daProds.Update(dsNwind, "Prods")
The last line of code produces the error:
"Incorrect syntax near the keyword 'Percent'."
I tried commenting out the line :
drProd.Item("Percent") = 5
but still got the same error.
Any help is appreciated.
Thanks,
Phil
I'm new to '.net'. I'm working in vb.net and have an error don't know the cause of or how I should go about debugging it.
Here is the code:
Dim dsNwind As New DataSet
Dim daProds As New SqlDataAdapter(cmdSelProds)
daProds.Fill(dsNwind, "Prods")
Dim drProd As DataRow
drProd = dsNwind.Tables("Prods").NewRow
drProd.Item("ProductId") = 1006
drProd.Item("Name") = "widget"
drProd.Item("Grams") = "11g"
drProd.Item("Percent") = 5
dsNwind.Tables("Prods").Rows.Add(drProd)
daProds.Update(dsNwind, "Prods")
The last line of code produces the error:
"Incorrect syntax near the keyword 'Percent'."
I tried commenting out the line :
drProd.Item("Percent") = 5
but still got the same error.
Any help is appreciated.
Thanks,
Phil