日期:2014-05-19  浏览次数:20881 次

请教:错在哪里了???

                string       datenow   =   System.DateTime.Now.ToString   ();
                string     mchead_pic= "1 ";
                try
                {
                        OleDbConnection   conn   =   new   OleDbConnection();
                        conn.ConnectionString   =   "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   +   Server.MapPath(@ "#ncbbs.mdb ");
                        conn.Open();
                        string   cmdstr   =   "INSERT   INTO   users(username,nick_name,password,mailbox,sex,tel,address,qq,head_pic,sign_word,reg_time)   VALUES   ( ' ";//添加插入语句
                        cmdstr   =   cmdstr   +   txtName.Text   +   " ', ' "   +   txtNickname.Text   +   " ', ' "   +   txtpassword1.Text   +   " ', ' "   +   txtmailbox.Text   +   " ', ' "   +   cbx.Text   +   " ', ' "   +   txtTel.Text   +   " ', ' ";
                        cmdstr   =   cmdstr   +   txtAdd.Text   +   " ', ' "   +   txtQQ.Text   +   " ', ' "   +   mchead_pic   +   " ', ' "   +   txtword.Text   +   " ', ' "   +   datenow   +   " ') ";
                       
                        OleDbCommand   com   =   new   OleDbCommand();
                        com.CommandText   =   cmdstr;
                        com.CommandType   =   CommandType.Text;
                        com.CommandTimeout   =   60;
                        com.Connection   =   conn;
                        com.ExecuteNonQuery();
                        conn.Close();
                        Response.Redirect( "Default.aspx ");
                }
                catch   (Exception   err)
                {
                        txtword.Text   =   err.ToString();
                }