-
Jul 20th, 2012, 09:35 AM
#1
Thread Starter
Member
Select/ Sum Statement In Visual Basic
I have in select statement, which retrieve all data from a SQL Table. But what im trying to get the select statment to do is, sort the data, in group them. In give a sum of the same data. I will need this in a select statment. Can someone please help?
Public Class Inventory_Summary
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim cnn As SqlConnection
Dim connectionString As String
Dim sql As String
connectionString = "Server=10.53.252.221;UID=phasqladmin;PWD=i82dothis;Database=phabsproduction;Integrated Security=False"
cnn = New SqlConnection(connectionString)
cnn.Open()
sql = "Select * from YF_Safety_Stock_Inventory"
Dim dscmd As New SqlDataAdapter(sql, cnn)
Dim ds As New DataSet
dscmd.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
cnn.Close()
Exit Sub
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|