SQL SERVER2005的一个奇怪问题,急,急,急!!!!!
我自己写了个Web   service,用的是SQL   SERVER2005数据库,然而当我新建另一个数据库后,把Web   service中的与数据库有关的代码更改后,访问这个新建的数据库却总是报如下错误   
 关键字    'user '   附近有语法错误。   
 user是我在新数据库里新建的一张表。数据库权限问题已经排除,因为所有数据库的权限我都设为一样的。我的代码如下: 
 public   bool   login(string   username,   string   userpassword) 
             { 
                         bool   b   =   false; 
                         string   connstr   =    "Data   Source=ANDY;Initial   Catalog=eve;Integrated   Security=True "; 
                         SqlConnection   conn   =   new   SqlConnection(connstr); 
                         SqlCommand   comm   =   new   SqlCommand( "select   *   from   user   where   name=@name   and   pwd=@password ",   conn); 
                         comm.Parameters.Add( "name ",   SqlDbType.VarChar); 
                         comm.Parameters.Add( "password ",   SqlDbType.VarChar); 
                         comm.Parameters[ "name "].Value   =   username; 
                         comm.Parameters[ "password "].Value   =   userpassword; 
                         if(conn.State==ConnectionState.Closed) 
                         { 
                                     conn.Open(); 
                                     MessageBox.Show( "hao "); 
                         } 
                         SqlDataReader   result   =   comm.ExecuteReader(); 
                         if   (result.Read()   ==   true) 
                         {   b   =   true;   } 
                         result.Close(); 
                         conn.Close(); 
                         return   b; 
             }   
 就是换了数据库,就不能访问了。 
------解决方案--------------------from [user] where
------解决方案--------------------加[]
------解决方案--------------------凡是带有特殊字符或与系统保留字冲突的字段名、表名,都要加[]   
 如:   
 [姓   名]   
 [123]