problem with DataBase

L

Lian

hi
Hi
I have a problem with a dataset. Im trying to update the database but
it doesn't updating the database
this.oleDbConnection1 .Open ();
OleDbCommand cmd = new OleDbCommand ("",this.oleDbConnection1);
cmd.CommandText = "UPDATE Manufactor SET ,factor_Size="
+company.manufactorfloor_get ()+ " WHERE player_ID='"+
this.Session["playerID"].ToString()+"'";//,Finished_Product="+
this.company.fnsdprod_get () + ",Finished_Product_Space="+this.company
..machine_out_put_get ()+ ",Machine_Num="+ this.company.machinenum_get
()
this.oleDbDataAdapterManufactor .UpdateCommand =cmd;
this.lerrorlable .Text =this.oleDbDataAdapterManufactor .Update
(this.dsManufactor1).ToString ();
this.oleDbConnection1 .Close ();
 
P

Peter Jausovec

Hi,

Does it thrown an exception ?

I think the error is in this line (it think it should be without comma (SET
factor_Size))
cmd.CommandText = "UPDATE Manufactor SET ,factor_Size="
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Try to use parameters, the thing with such a construction is that you need
to escape the especial chars for SQL , example if
this.company.machine_out_put_get ()
return Moe's ( very good mexican restaurant btw ) it will give you error
as the ' will be interpreted as part of the SQL query.

Cheers,
 

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

Top