Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA Insert Stement for SQLServer

I have data as follows on EXCEL:

ColA ColB
MARC 123
marc1234 234
marc1235 555/0

I have a SQL table with the same structure. I want to insert the range.
I tried:

Dim cName1, cName2 As Variant
cName1 = Range("A")
cName2 = Range("B")

sq = "Insert into marc_temp_excel (ColA, ColB) values (cName1, cName2)"
Set r = c.Execute(sq)
c.Close

MsgBox ("marc_temp_excel Table Successfully Updated.")

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA Insert Stement for SQLServer

got iot but have a syntax error as in 'VBA Syntax' thread above.

"marcmc" wrote:

I have data as follows on EXCEL:

ColA ColB
MARC 123
marc1234 234
marc1235 555/0

I have a SQL table with the same structure. I want to insert the range.
I tried:

Dim cName1, cName2 As Variant
cName1 = Range("A")
cName2 = Range("B")

sq = "Insert into marc_temp_excel (ColA, ColB) values (cName1, cName2)"
Set r = c.Execute(sq)
c.Close

MsgBox ("marc_temp_excel Table Successfully Updated.")

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - MS sqlserver 2000 connection wannesh Excel Discussion (Misc queries) 0 February 3rd 06 03:10 PM
ADODB from SQLServer - IF function? onedaywhen[_2_] Excel Programming 1 January 12th 05 02:21 PM
Excel Front End , SqlServer Backend in the web [email protected] Excel Programming 0 September 30th 03 05:11 PM


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"