OleDbCommand format question

G

Guest

I have reviewed the MS knowledgebase fairly extensively and I have looked
over past threads on this topic. It seems I can added a new record to a
spreadsheet with:
Try
Dim str_Conn As String = "provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\Documents and
Settings\Mark\My Documents\Database\Book1.xls;" & _
"Extended Properties=Excel 8.0;"
Dim objConn As New System.Data.OleDb.OleDbConnection(str_Conn)
objConn.Open()

'Add two records to the table.
Dim objCmd As New System.Data.OleDb.OleDbCommand
objCmd.Connection = objConn
objCmd.CommandText = "Insert into [Sheet3$] (FirstName,
LastName)" & _
" values ('Bill', 'Brown')"
objCmd.ExecuteNonQuery()
objConn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try

What is the form of the command if I want to put the number 6 in cell C12 of
Sheet3?
 
L

Lucky

well i guess you can directly use the header of the column C12 like you
used firstname and lastname in your query and fire it with value. i've
not tried but according to SQL standards it should work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top