我在oledbcommand中有这个sql命令:
insert into tweets(iso_language_code,created_at,id_str,textbody,truncated,in_reply_to_status_id_str,in_reply_to_user_id_str,in_reply_to_screen_name,user,id_str1,username,screen_name,location,description,url,description1,followers_count,friends_count,listed_count,created_at1,favourites_count,utc_offset,time_zone,geo_enabled,verified,statuses_count,lang) values ('en','Tue Nov 05 234107 +0000 2013','397871229903716353','TrophyManager','false','null','null','null','','1401457136','DE-football','football_bot_DE','','Football news in German \/ Fu\u00dfball Nachrichten auf Deutsch\r\n#football #Fussball #German #Germany #Deutsch #Deutschland #Bundesliga #Followback #TeamFollowBack','urlhttp\/\/t.co\/vwBeatWiSO','urls','2948','2866','2','Sat May 04 051820 +0000 2013','0','3600','Berlin','false','false','13074','en')
我收到语法错误但是当我将其复制到访问并运行时,它会运行。
答案 0 :(得分:2)
应该是:
INSERT INTO Table_Name (column1,colum2,etc) VALUES (value1,value2,etc.);
所以你忘记了INTO
答案 1 :(得分:2)
如果您仍然遇到INSERT INTO
错误,则问题可能是reserved words字段名称:user;和描述。
将这些名称括在方括号中,以避免混淆数据库引擎。
in_reply_to_screen_name,[user],id_str1
保留字令人沮丧。它们可能并不总是为Access应用程序会话中的查询运行造成麻烦。但是使用OleDb从Access外部运行的查询似乎不太容忍保留字。
答案 2 :(得分:0)
以下是我在SQL语句中看到的错误:
INSERT INTO tweets
代替insert tweets
'
。'
放在它周围。'
。因此,通过以上所有更改,您的查询可能如下所示:
INSERT INTO tweets
(
iso_language_code, created_at, id_str, textbody,
truncated, in_reply_to_status_id_str, in_reply_to_user_id_str,
in_reply_to_screen_name, [user], id_str1, username, screen_name,
location, [description], url, description1, followers_count, friends_count,
listed_count, created_at1, favourites_count, utc_offset, time_zone,
geo_enabled, verified, statuses_count, lang
)
VALUES (
'en', CDATE('2013-11-05 23:41:07'), 397871229903716353,
'TrophyManager', False, Null, Null, Null, '', 1401457136, 'DE-football',
'football_bot_DE', '',
'Football news in German \/ Fu\u00dfball Nachrichten auf Deutsch\r\n#football #Fussball #German #Germany #Deutsch #Deutschland #Bundesliga #Followback #TeamFollowBack',
'urlhttp\/\/t.co\/vwBeatWiSO', 'urls', 2948, 2866, 2,
'Sat May 04 051820 +0000 2013', 0, 3600, 'Berlin', False, False,
13074, 'en'
)