title: error reading incorrect syntax near 'value' when tries to register user and password hashing
body: <p>I m using microsoft sql server as database and having client server chatting server..when client register and the password will be hashing and stored in server database..however, there is 63531 ERROR reading: Incorrect syntax near 'value'. my database username datatype is varchar and password is nvarchar to let the password hashing to store utf8 into it</p>
  
  <p>coding for database connection and register</p>
  
  <pre><code>public class DBConnection {
          java.sql.Connection conn = null;
  
  
      public static java.sql.Connection connect(){
          try{
              Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
              java.sql.Connection conn = DriverManager.getConnection("jdbc:sqlserver://127.0.0.1;"+"user=looi963;password=1234;database=user");
              return conn;
          }
          catch(Exception e){
              JOptionPane.showMessageDialog(null,e);
              return null;
          }
  
  }
      public void regis(String name,String password) throws SQLException
      {
          connect();
          PreparedStatement state=conn.prepareStatement("Insert into user where username=? and password=?");
          state.setString(1,name);
          state.setString(2, md5(password));
  
          int count = state.executeUpdate();
         if(count&gt;0)
         { 
             System.out.println("aaddde");
         }
      }
      private String md5(String c) {
          try {
              MessageDigest digs = MessageDigest.getInstance("MD5");
              digs.update((new String(c)).getBytes("UTF8"));
              String str = new String(digs.digest());
              return str;
          }catch (Exception ex){
              return "";
          }
  </code></pre>
  
  <p>and this is the server side coding</p>
  
  <pre><code>public void regis(String name,String password) throws SQLException
      {
  
      try {
          Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
      } catch (ClassNotFoundException ex) {
          Logger.getLogger(SocketServer.class.getName()).log(Level.SEVERE, null, ex);
      }
         java.sql.Connection conn = DriverManager.getConnection("jdbc:sqlserver://127.0.0.1;"+"user=looi963;password=1234;database=user");
          PreparedStatement state=conn.prepareStatement("Insert into [user] (username,password) value(?,?)");
          state.setString(1,name);
          state.setString(2, md5(password));
  
          int count = state.executeUpdate();
         if(count&gt;0)
         { 
             System.out.println("aaddde");
         }
      }
  </code></pre>