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());
}
}
Loading
Sam HobbsPosted Dec 2, 2010, 1:49 PM
While debugging the program, when the exception occurs, look at the parameters of QLHSC3.HOCSINH.HocSinhData.insert. At least one of the parameters is null.
Tam NguyenPosted Dec 2, 2010, 9:15 AM
image throw error when execute step by step.
help me, please!
Suthish NairPosted Dec 2, 2010, 4:50 AM
Tam NguyenPosted Dec 2, 2010, 3:40 AM
at QLHSC3.HOCSINH.HocSinhData.insert(String maHS, String tenHS, String phai, DateTime ngaySinh, String diachi, String maLop, String email, Int32 siso) in E:\backup\QLHSC3\QLHSC3\HOCSINH\HocSinhData.cs:line 46
Suthish NairPosted Dec 2, 2010, 3:16 AM
Welcome to C# Corner.
Can you provide more information, like what error you getting.
Put a breakpoint and check which line throwing error.
Or, check Our recommended articles section for oracle artilcles.
Some samples already there to help you.
Suthish NairPosted Dec 2, 2010, 3:10 AM
Are you Spamming the forum. Same messages getting copy pasted in each thread.
Tam asked for a solution for his question.
CrishPosted Dec 2, 2010, 1:36 AM
I have same problem .Thanks for giving solution of this issue. now it will help us in our project.