View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
doristsr[_3_] doristsr[_3_] is offline
external usenet poster
 
Posts: 1
Default how to link to DB to update data?


Hi;

I m new in VBA, can anyone tell me is it possible to use VBA to
update data to a database?

I m actually using a string like below to connect to my db:

Let DSN = Sheets("Settings").Range("B7").Value
strConn = "OLEDB;Provider=MSDASQL.1;Persist Security
Info=False;User ID=ABC;Password=password;Data Source='" & DSN & "'"

if i have a query:
StrSQL = "update table set field1='123' where id = 'abc'"

may i know how to code so that i could execute this StrSQL?

Thanks for your help :)
Doris


--
doristsr
------------------------------------------------------------------------
doristsr's Profile: http://www.excelforum.com/member.php...o&userid=35881
View this thread: http://www.excelforum.com/showthread...hreadid=558721