Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cnstr As String = "demo connection string"
Dim Query As String = "select * from table"
Dim tmptbl As New DataTable
Dim conn As New SqlConnection(cnstr)
Using conn
conn.Open()
Dim cmd As New SqlCommand(Query, conn)
cmd.CommandType = CommandType.Text
Using cmd
Dim dr As SqlDataReader = cmd.ExecuteReader
tmptbl.Load(dr)
End Using
conn.Close()
End Using
Dim number As Integer = calc(tmptbl.Rows(0)(0).ToString, tmptbl.Rows(1)(1).ToString)
Label1.Text = number.ToString
End Sub
Private Function calc(ByVal s1 As String, ByVal s2 As String) As Integer
Dim i As Integer = Integer.Parse(s1)
Dim j As Integer = Integer.Parse(s2)
Dim total As Integer
'do some math function...
Return total
End Function
should be enough to get you started- you will need to figure out how to get you index- follow the link in my sig for the msdn class lib... also most searches with the key words of class C# or VB will hit the msdn lib as top hit
note- this is a windows form- quicker to make a sln as form, but concept is the same... attach that process to a page load or a button click or whatever