I have a Class that is creating a large dataset (over 32,000 records) on the fly. I want to take the dataset and import it directly into SQL Server 2005 but I have not been able to find anything in ADO that allows me to do that all in one chunk.

Doing a search I found some people in a similar situation that have exported the dataset to an XML file and then imported into SQL Server, which seems like a long way to go just to get something done that I would think would be part of ADO.Net.

However, for lack of a better option, I went a head and created the XML file but now I am having problems getting it to import into SQL Server so before I lose another day of productivity I am goin to ask a question.

Is there a way to insert a dataset directly into SQL Server without going to a file first (even if I have to do it one row at a time)?
VB Code:
  1. '        cnn.Open()
  2.         Try
  3.             Dim cmd As SqlCommand = New SqlCommand("TimeCards", cnn)
  4.             cmd.CommandType = CommandType.StoredProcedure
  5.             cmd.CommandTimeout = 0
  6.             cmd.Parameters.AddWithValue("@StateID", "45")
  7.             cmd.Parameters.AddWithValue("@StoreID", "ABCDEF")
  8.             cmd.Parameters.AddWithValue("@From", dtStartDate)
  9.             cmd.Parameters.AddWithValue("@To", dtEndDate)
  10.             cmd.ExecuteNonQuery()
  11.             da.SelectCommand = cmd
  12.             da.Fill(dsHours, "EmpHours")
  13.  
  14.             CheckForFile(strFilePath)
  15.  
  16.         Catch ex As Exception
  17.             bolSucceed = False
  18.         Finally
  19.             cnn.Close()
  20.             cnn.Dispose()
  21.             da.Dispose()
  22.         End Try