Unhandled Exception while executing SQL command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bardiyam
    New Member
    • Mar 2007
    • 6

    #1

    Unhandled Exception while executing SQL command

    hi
    Im trying to create connection in c# with Access database
    and got exception at command.Execute NonQuery()--

    Unhandled Exception of type 'System.Data.Ol eDb.OleDbExcept ion' occured in System.Data.dll

    Additional Information : Syntax Error in Field Definition

    Thank you in advance,
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    Can you please specify your SQL query ? There must be some syntax error.

    Comment

    • bardiyam
      New Member
      • Mar 2007
      • 6

      #3
      hi
      it is
      cmd = new OleDbCommand(Cr eate Table a1 (no integer,name char(10)",s')

      s is connection name;
      it gives error at cmd.ExecuteNonQ uery();

      wat is going wrong?


      thanks.

      Comment

      • shweta123
        Recognized Expert Contributor
        • Nov 2006
        • 692

        #4
        Hi,

        You should write it as

        cmd = new OleDbCommand(Cr eate Table a1 (no integer,name char(10),s)

        Comment

        Working...