简体   繁体   English

如何使用VBA将数据发送到网站数据库

[英]how to send data to website database using vba

I'm having trouble on how to word this in to a google search and couldn't find many results with what I tried. 我在将其写到Google搜索中时遇到了麻烦,无法通过我的尝试找到很多结果。

I am re-writing a VBA program (using MS Access) for our company. 我正在为公司重新编写VBA程序(使用MS Access)。 We run queries and reports for multiple external sources. 我们针对多个外部来源运行查询和报告。 I am required to send this to a third party who is helping us. 我必须将此发送给正在帮助我们的第三方。 What I would like to do is know when it is being used so I want to implement a procedure that submits usage information to our company website. 我想知道的是何时使用它,因此我想实现一个将使用信息提交到我们公司网站的过程。

I have look at doing via MySQL and directly writing to the website backend database but not everyone will have the MySQL driver installed, plus with our hosting company, it requires we know the IP address of the computer sending the information for it to get past the firewall. 我已经考虑过通过MySQL进行操作并直接写入网站后端数据库,但并不是每个人都将安装MySQL驱动程序,加上我们的托管公司,它要求我们知道发送信息的计算机的IP地址,以便其通过防火墙。 My only other idea is for it to submit the information to a web form and post it. 我唯一的想法是将信息提交到Web表单并发布。 I have controlled websites before using VBA but I want it to be quiet and unobtrusive. 在使用VBA之前,我已经控制过网站,但我希望它安静且不引人注目。

It's not something that has to work every time. 并非每次都必须工作。 It's more so we know if the application gets distributed outside of who we give it to. 更重要的是,我们知道应用程序是否分发给我们的应用程序。

Any ideas?? 有任何想法吗??

Thank you. 谢谢。

Here's how to do it in VBA for Excel , I assume it'll be similar in Access.. 这是在VBA for Excel中执行此操作的方法,我认为它在Access中会类似。

Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

URL = "http://www.somedomain.com"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.send ("var1=value1&var2=value2&var3=value3")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM