problem on oledbparamter of asp.net

Joined
Jun 30, 2006
Messages
2
Reaction score
0
Hi all,
The following is my code:
private void Update_data(Object sender, DataGridCommandEventArgs e)
{
try
{
String updateCmd = "update rohsdb set Supplier=? where PortNo=?";
OleDbConnection myConnection= new OleDbConnection("Provider=MSDAORA; Data Source=***;User ID=system;Password=***");
OleDbCommand myCommand = new OleDbCommand(updateCmd,myConnection);

myCommand.Parameters.Add(new OleDbParameter("@PortNo",OleDbType.VarChar,50));
myCommand.Parameters["@PortNo"].Value= DataGrid1.DataKeys[(int)e.Item.ItemIndex];

myCommand.Parameters.Add(new OleDbParameter("@Supplier",OleDbType.VarChar,50));
myCommand.Parameters["@Supplier"].Value= ((TextBox)e.Item.FindControl("edit_supplier")).Text;

myConnection.Open();
myCommand.ExecuteNonQuery();
DataGrid1.EditItemIndex=-1;
Show_data();

}
catch(System.InvalidCastException d)
{
Message.Text="Update failed" + d.ToString();
}

}



when running the program, no error occurs. but the data can not be updated. i don't know why. ( i am using oracle server)



can anyone help me? PLZ i am nearly crazy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top