帮助VB + SQL代码 [英] Help with VB + SQL code

查看:75
本文介绍了帮助VB + SQL代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在VB代码中使用SQL代码并且我在第一个选择语句中不断收到预期案例错误,任何人都可以帮我这个吗?


谢谢


ConnectionString =" Provider = SQLOLEDB.1; server = wsus; Integrated Security = SSPI; Persist Security Info = False; Initial Catalog = inv_tracking"

set cn = CreateObject(" ADODB.Connection")

cn.Open ConnectionString

mStringSQL =" INSERT INTO driver_destroyed_log(emp_id,date_recieved,violation,form_manner, log_status,status_date,date_destroyed,comments,log_id)"


SELECT Driver_daily_logs.emp_id,Driver_daily_logs.date_recieved,Driver_daily_logs.violation,Driver_daily_logs.form_manner,Driver_daily_logs.log_status,Driver_daily_logs.status_date,Driver_daily_logs .date_destroyed,Driver_daily_logs.comments,Driver_daily_logs.log_id

FROM Driver_daily_logs

WHERE DATE()> date_destroyed;

CN.Execute(mStringSQL)

解决方案

你能详细指出错误吗?


我得到的第一个错误是选择stements上的大小写错误。然后,当我将select语句放在括号中时,它给出了一个Expected Statement错误。


因为我在InfoPath中开发,所以当我得到两个错误时没有显示的错误号

I am trying to useSQL code inside VB code and I keep getting an Expected Case error on my first select statement, can any one help me with this??

Thanks

ConnectionString = "Provider=SQLOLEDB.1;server=wsus;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=inv_tracking"
set cn = CreateObject("ADODB.Connection")
cn.Open ConnectionString

mStringSQL ="INSERT INTO driver_destroyed_log ( emp_id, date_recieved, violation, form_manner, log_status, status_date, date_destroyed, comments, log_id )"

SELECT Driver_daily_logs.emp_id, Driver_daily_logs.date_recieved, Driver_daily_logs.violation, Driver_daily_logs.form_manner, Driver_daily_logs.log_status, Driver_daily_logs.status_date, Driver_daily_logs.date_destroyed, Driver_daily_logs.comments, Driver_daily_logs.log_id
FROM Driver_daily_logs
WHERE DATE()>date_destroyed;
CN.Execute (mStringSQL)

解决方案

Can you pointout errors in detail?


Well the first error I get is a case error on the select stements. Then when I put the select statement in brackets it gives me an Expected Statement error.


Since I am developing in InfoPath there is no error number that is displayed when I get the two errors


这篇关于帮助VB + SQL代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆