OLEDB DBase VI:字段定义中的语法错误 [英] OLEDB DBase VI :Syntax error in field definition

查看:118
本文介绍了OLEDB DBase VI:字段定义中的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

0

下来投票

最爱

当我得到这个时,我正在尝试创建一个DBF表错误字段定义中的语法错误。但是,语法没有任何问题,当我将某个列名从一个级别更改为级别时,它调试就好了!有谁有想法?这是代码:

0
down vote
favorite
I am trying to create a DBF table when i get this error "Syntax error in field definition." , however there is nothing wrong with syntax , and when I change a certain column name from level to levels it debug just fine! anybody have an idea ? here is the code:

 string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D://Temp;Extended Properties=dBase IV"; //MessageBox.Show(connectionString);

        OleDbConnection connection = new OleDbConnection(connectionString);
        connection.Open();



        /* ---------------------------  Filling The DBF Files ----------------------*/
        using (OleDbCommand cmd = connection.CreateCommand())
        {


            cmd.CommandText = @"CREATE TABLE clients(
                                                        nbrclient   int             ,   
                                                        level      varchar(1)      ,    
                                                        type        varchar(10)     ,
                                                        name        varchar(80)     ,   
                                                        name2       varchar(80)     ,   
                                                        fname       varchar(50)     ,   
                                                        vip         varchar(40)     ,
                                                        langue     varchar(3)      ,    
                                                        salutations varchar(30)     ,
                                                        gender      varchar(30)     ,
                                                        title       varchar(30)    
                                                        ) ";
cmd.ExecuteNonQuery();

      }

推荐答案

级别是保留字。我建议不要使用它。在Microsoft SQL中,你使用方括号,[level],但更好的想法是想到一个不同的单词。
Level is a reserved word. I would recommend not using it. In Microsoft SQL you use square brackets around it, [level], but a better idea is to think of a different word.


是的,ryanb31你是绝对正确的,Level是一个保留字和最好的事情是不要使用保留字思考一个更好的命名法,但由于整个系统使用那些相同的命名法我无法改变,至少现在不是,好消息是我找到了解决方法,在保留字之前和之后使用(`)而不是水平`Level`通过而没有任何问题注意不要混淆('')和(`)。

谢谢大家的好意和建议
Yes , ryanb31 you''re absolutly right , Level is a reserved word and the best thing is t not use reservedword a think of a better nomenclature , but since a whole system use those same nomenclature I cannot change, at least not right now, The good News is I have find a work around, Use (`) before and after the reserved word so instead of level `Level` passed with no problem at all Be careful not to confuse ('') with (`).
thank you all for your good word and advise


这篇关于OLEDB DBase VI:字段定义中的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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