Jump to content

Update


jteixeira

Recommended Posts

hi, I don't know if it is here but i hope that somebody help. I'm working in visual web developer in c# and i have a button, that when i click updates a row:

protected void Button3_Click(object sender, EventArgs e)	{		ObjectDataSource4.Select();	}

sql associated:

[WebMethod]	public bool anu(int nnumdoc, int cliente)	{		//Ligação		ConnectionString = "data source=" + txtIP + ";uid=" + txtUser + ";password=" + txtPass + ";database=" + txtNomeBD;		SqlConnection myconnection = new SqlConnection(ConnectionString);		SqlCommand cmd = new SqlCommand();		cmd.Connection = myconnection;		//Update		qstring = " if(Select DOCGCCAB.DATA+2" +				"	FROM DOCGCCAB INNER JOIN CLIENTES ON CLIENTES.CODIGO=DOCGCCAB.TERCEIRO" +				"	WHERE TPDOC='ENC' AND DOCGCCAB.NNUMDOC=" + nnumdoc + " AND NUMERO=" + cliente + ")>CURRENT_TIMESTAMP" +				"   BEGIN" +				"	UPDATE DOCGCCAB" +				"	SET NVIAS=-1" +				"	WHERE TPDOC='ENC' AND DOCGCCAB.NNUMDOC=" + nnumdoc + " AND TERCEIRO=(SELECT TOP 1 TERCEIRO FROM DOCGCCAB INNER JOIN" +				"														 CLIENTES ON CLIENTES.CODIGO=DOCGCCAB.TERCEIRO" +				"														 WHERE NUMERO=" + cliente + ")" +				"   END" +				"   ELSE" +				"	Select 'Não pode anular esta encomenda, o prazo limite foi ultrapassado(48 horas)' 'Aviso'";		cmd.CommandText = qstring;		try		{			cmd.Connection.Open();			cmd.ExecuteNonQuery();			cmd.Connection.Close();		}		catch (System.Data.SqlClient.SqlException err)		{			return false;		}		return (true);	}

i want to know how i can print this page in my current web page.sorry in inglish :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...