I am trying to insert a DataTable into a SQL Server database. I'm not sure the best way to go about this. Should I loop through each row in the DataTable and insert them indvidually with seperate Insert statements or is there a way to Insert the entire DataTable with one shot. Is anyone familiar with the TableAdapter.Insert method? I've looked this over and it looks somewhat like what I'm looking for. Here's an example of some of my code so you have and idea what I'm trying to do here. Please provide any examples you might have. Much appreciated.
public void InsertTrackingData(DataTable ClickTrackData)
{
DataTable returnVal = new DataTable("ClickTrack");
SqlCommand doit = new SqlCommand("INSERT click_tracking (User_ID, Session_ID, Client_Type, Action_Type, UI_Element, UI_Parent, UI_Form) VALUES (5, 'NorthWestern')");
public void InsertTrackingData(DataTable ClickTrackData)
{
DataTable returnVal = new DataTable("ClickTrack");
SqlCommand doit = new SqlCommand("INSERT click_tracking (User_ID, Session_ID, Client_Type, Action_Type, UI_Element, UI_Parent, UI_Form) VALUES (5, 'NorthWestern')");