Click here to Skip to main content
15,913,090 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I need an urgent help please?

I get error:
cannot implicitly convert type 'string' to 'system.data.datarow'

I want to add datatable rows dynamically but it is not capturing rows i tried many methods..
Posted
Comments
Sergey Alexandrovich Kryukov 28-Feb-12 17:45pm    
First, the error message is straightforward. Those are different types, not assignment compatible.
Secondly, why asking questions like that without code sample?
My access to your hard drive is somewhat limited at the moment... :-)
--SA

try something like this:
C#
dataTable.Rows.Add(new DataRow(myString));
 
Share this answer
 
Comments
JawadHafiz 28-Feb-12 14:05pm    
i have a row, i want to insert last columns
[no name] 28-Feb-12 14:17pm    
you mean you want to update the column value in an existing row?

dataTable.Rows[0]["ColName"] = "Value";
Member 14530922 26-Aug-19 2:29am    
i am getting error of cannot implicitly convert system.data.datatable into string
Try this:

C#
dataTable.NewRow();
DataRow Row1 = new DataRow();
Row1["NameOfTheColumn1"]="Text here";
Row1["NameOfTheColunm2"]="Text here";
dataTable.Rows.Add(Row1);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900