Environment versions
Network:
Windows 2008 Server
>using following c# code, I am trying to get sum of a field "LNOD" type varchar in a variable "mysum"
>
>protected void Button7_Click(object sender, EventArgs e)
>{
>SqlConnection con = new SqlConnection("Server=SDCHO\\SQLEXPRESS;Database=LoginPage;Trusted_Connection=true");
>con.Open();
>SqlCommand myCommand2 = new SqlCommand("select sum(lnod) as mysum from LeaveDataTable where ID='212' ", con);
>myCommand2.ExecuteNonQuery();
>Response.Write('The Sum of LNOD is :' + mysum);
>con.Close();
>}
>
>please help it is not working
Not working how? Does it error out or do you just not get a result?
Also, have you examined LeaveDataTable to verify that there are positive values of lnod where ID='212'?
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only