Hello,
I need to build a SQL string that with return a total from a SQL database table field that I can pass to a textbox. I believe I have the correct syntax for doing this, however it is not working. Here is a brief example of my code. Also, when I execute this same SQL string using MS Visual FoxPro as my front end it returns a total to the variable total1 just fine.
strSQL = "SELECT SUM(units) AS total1 FROM cart"
cnSQL = New SqlConnection(ConnectionString)
cnSQL.Open()
cmSQL = New SqlCommand(strSQL, cnSQL)
cmSQL.ExecuteNonQuery()
txttotal.Text = CStr(total1)
Thanks,
FoxT
I need to build a SQL string that with return a total from a SQL database table field that I can pass to a textbox. I believe I have the correct syntax for doing this, however it is not working. Here is a brief example of my code. Also, when I execute this same SQL string using MS Visual FoxPro as my front end it returns a total to the variable total1 just fine.
strSQL = "SELECT SUM(units) AS total1 FROM cart"
cnSQL = New SqlConnection(ConnectionString)
cnSQL.Open()
cmSQL = New SqlCommand(strSQL, cnSQL)
cmSQL.ExecuteNonQuery()
txttotal.Text = CStr(total1)
Thanks,
FoxT