7
Answers

insert to oracle database using procedure

Ask a question
Tam Nguyen

Tam Nguyen

13y
11.5k
1
i have a problem for update table in winfom to oracle database 10g. insert using procedure in oracle. it do not update succesful. help me, please:((
when aplication was execute, do not insert. thanks you very much.
this is my code for insert funtion:
public void update(string studentCode, string Name,string sex, DateTime birthday, string address, string ClassID,string email)
        {
            try
            {
                String birthday1=birthday.ToShortDateString();
                provider.command.Connection =provider.connection ;
                provider.command.CommandType=System.Data.CommandType.StoredProcedure;
                provider.command.CommandText="UPDATE_STUDENT";
                //_provider.command.CommandType=System.Data.CommandType.StoredProcedure;
                //MAHS
                p= new OleDbParameter();
                p.Direction=System.Data.ParameterDirection.Input ;
                p.OleDbType=System.Data.OleDb.OleDbType.VarChar  ;
                p.Value=maHS;
                provider.command.Parameters.Add(p);
                //HOTEN
                p= new OleDbParameter();
                p.Direction=System.Data.ParameterDirection.Input ;
                p.OleDbType=System.Data.OleDb.OleDbType.VarChar  ;
                p.Value=tenHS;
                provider.command.Parameters.Add(p);
           
                //PHAI
                p= new OleDbParameter();
                p.Direction=System.Data.ParameterDirection.Input ;
                p.OleDbType=System.Data.OleDb.OleDbType.VarChar  ;
                p.Value=phai;
                provider.command.Parameters.Add(p);
                //ngaysinh
                p= new OleDbParameter();
                p.Direction=System.Data.ParameterDirection.Input ;
                p.OleDbType=System.Data.OleDb.OleDbType.VarChar  ;
                p.Value=ngay_sinh;
                provider.command.Parameters.Add(p);

                //DIACHI
                p= new OleDbParameter();
                p.Direction=System.Data.ParameterDirection.Input ;
                p.OleDbType=System.Data.OleDb.OleDbType.VarChar  ;
                p.Value=diachi;
                provider.command.Parameters.Add(p);
                //EMAIL
                p= new OleDbParameter();
                p.Direction=System.Data.ParameterDirection.Input ;
                p.OleDbType=System.Data.OleDb.OleDbType.VarChar  ;
                p.Value=email;
                provider.command.Parameters.Add(p);
                       
                provider.command.ExecuteNonQuery();
            }
            catch (Exception e)
            {
               
                throw new Exception(e.ToString());   
            }

        }

Answers (7)