Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

ok... i have a simple query... really simple

 

string sql="UPDATE tblParametre SET image=\"" + nomFichier[nomFichier.Length-1] +"\"" ;

SQL.ExecuteNonQuery(sql);

 

wich gives: "UPDATE tblParametre SET image="goutte.JPG""

 

the name of the pic is only a string... the UPDATE works well if i put it directly in access, but from my code it just wont work

 

the SQL.ExecuteNonQuery comes directly from msdn

 

	public static void ExecuteNonQuery(string sql)
	{
		OleDbConnection conn = null;
		try
		{

			conn = new OleDbConnection(
				"Provider=Microsoft.Jet.OLEDB.4.0; " + 
				"Data Source=" +  HttpContext.Current.Server.MapPath("rootInextenso.mdb"));
			conn.Open();

			OleDbCommand cmd = 
				new OleDbCommand(sql, conn);
			cmd.ExecuteNonQuery();
		}
			//  catch (Exception e)
			//  {
			//      Response.Write(e.Message);
			//      Response.End();
			//  }
		finally
		{
			if (conn != null)  conn.Close();
		}
	}

 

i really cant see what's wrog with this code...

 

im getting an: Syntax error in the UPDATE statement... wich does not make sense... i tryed to chang the " " " to " ' " i tryed to put a where anything not like something (just to say i had a where... even if it's uselless cuz i dont want any since i want it to apply to the whole table)

... not working

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...