Insert datatable in to sql table
asp.net, c#
Solution
DataTable dt = new DataTable();
string sql = "";
for (int i = 0; i < dt2.Rows.Count; i++)
{
sql = sql + "insert into InvitationData (Col1, Col2, ColN) values('"
+ dt2.Rows[i]["columnname"].ToString().Trim() + "','"
+ dt2.Rows[i]["columnname"].ToString().Trim() + "','"
+ dt2.Rows[i]["columnname"].ToString().Trim() + "')";
}
Problem
I have a datatable named `dt2`. And it contains some data. I want to add these data to my table named `invitationdata`. How can I write the code? Can any one help?