HI...
I have a web page that pass aa context to another..
The second page receives the context and need to put the value of the
context into a sql table..
The value is passing ok, 'cause i have a label that print the value, and
it's alright...
I pass the context value to a variable and try to imput it on the table
but the field always receive a 0 value...
heres my code:
int empresa= new int();
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
empresa=Convert.ToInt32(Context.Items["id_emp"].ToString());
Label7.Text=empresa.ToString();
}
// Here the label display the correct value of the "id_emp"
SqlConnection cnn = new
SqlConnection("server=(local);database=varired;tru sted_connection=true")
;
SqlCommand cmm = new SqlCommand("Insert into contatos
(id_cliente,contato,depto,ddd,fone,ramal,email) values
(@a,@b,@c,@d,@e,@f,@g)",cnn);
cmm.Parameters.Add("@a",SqlDbType.Int).Value=empre sa;
//But here it insert the number 0 on the table...
How can this happen???
[]s...
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!