Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. how can i import data from excel to sqlserver using vb6.0

how can i import data from excel to sqlserver using vb6.0

Scheduled Pinned Locked Moved Visual Basic
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koolprasad2003
    wrote on last edited by
    #1

    hello frnd, i have a Excel file with data and i want to import that excel file in MSSqlServer using vb6.0, how can i do that....please help if any one have code then please give me...:confused: any helpful link ???? thankx in advance regards, koolprasad2003:) Be a good listener...Because Opprtunity knoughts softly...N-Joy

    I 1 Reply Last reply
    0
    • K koolprasad2003

      hello frnd, i have a Excel file with data and i want to import that excel file in MSSqlServer using vb6.0, how can i do that....please help if any one have code then please give me...:confused: any helpful link ???? thankx in advance regards, koolprasad2003:) Be a good listener...Because Opprtunity knoughts softly...N-Joy

      I Offline
      I Offline
      ips_sun
      wrote on last edited by
      #2

      hi, These is the routine I am using. It works fine.. I move the each cells to an specific field (str... = string or int... = integer) and I use the fields to update the data base. I hope it helps you =================================================================================== Option Explicit Dim xl As New Excel.Application Dim xlw As Excel.Workbook Private Sub Excel name_KeyPress(KeyAscii As Integer) ' the combo-box has the Excel name If KeyAscii = 13 Then Set xlw = xl.Workbooks.Open("C:\List\Excel\" _ & Excel name) xlw.Sheets("Plan1").Select ' start in the second row because the first one it is the head x = 2 '(Row) Do While xlw.Application.Cells(x, 1).Value <> "" strTratamento = xlw.Application.Cells(x, 1).Value strNomeConvidado = xlw.Application.Cells(x, 2).Value intQtde = xlw.Application.Cells(x,3).Value strName01 = xlw.Application.Cells(x, 4).Value strName02 = xlw.Application.Cells(x, 5).Value strName03 = xlw.Application.Cells(x, 6).Value strName04 = xlw.Application.Cells(x, 7).Value strName05 = xlw.Application.Cells(x, 8).Value strName06 = xlw.Application.Cells(x, 9).Value strName07 = xlw.Application.Cells(x, 10).Value strName08 = xlw.Application.Cells(x, 11).Value intDDD01 = xlw.Application.Cells(x, 12).Value strTelefone01 = xlw.Application.Cells(x, 13).Value intDDD02 = xlw.Application.Cells(x, 14).Value strTelefone02 = xlw.Application.Cells(x, 15).Value intDDD03 = xlw.Application.Cells(x, 16).Value strTelefone03 = xlw.Application.Cells(x, 17).Value strOrign = xlw.Application.Cells(x, 18).Value strObservers = xlw.Application.Cells(x, 19).Value ' Include here the routine to update the SQL Server data base x = x + 1 Loop xlw.Close False Set xlw = Nothing Set xl = Nothing subLiberaForm Screen.MousePointer = vbDefault End If End If End Sub Regards IPS

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups