Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Sum(SqlColumn) as myvar from
Message
De
17/01/2015 03:20:52
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Select Sum(SqlColumn) as myvar from
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01613775
Message ID:
01613775
Vues:
33
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform