Hi all

I'm populating a dataset getting data from an Excel file, and that's working good. What I want to do now is to load this data to a database using SQL...

So is it possible to retrieve data from a Dataset via SQL?

This is the code I'm using:



Dim strXLSString As String = "Driver={Microsoft Excel Driver (*.xls)};DBQ="
+ xx + ";MaxScanRows=0;ReadOnly=False;"

Dim objConn As New OdbcConnection(strXLSString)

objConn.Open()

Dim objCmdSelect As New OdbcCommand("SELECT F1,F3,F6,F7,F8,F15,F18 FROM [x$A1:Z15000] WHERE F1 <> NULL", objConn)

Dim objAdapter As New OdbcDataAdapter(objCmdSelect)

objAdapter.SelectCommand = objCmdSelect

Dim objDataset As New DataSet

objAdapter.Fill(objDataset, "x")



'cnn is a connection to MSDE 2000 database



cnn.Open()

sqlStatement = "INSERT INTO Items (F1,F3,F6,F7,F8,F15,F18) " & _"VALUES (SELECT F1,F3,F6,F7,F8,F15,F18 FROM ....." 'here I should specify the datasource (ObjDataset???)

cmd = New SqlCommand(sqlStatement, cnn)

cmd.ExecuteNonQuery()

cnn.Close()