ここだと私たちのストアドプロシージャから結果を取得し、ボックスをテキストに返される列を割り当てる方法の一例:
Function GetInfoForStudent(ByRef QueryName As String, ByVal UserName As String, ByVal Password As String) As DataTable
Using Con As New SqlConnection
Try
Using OleCon As New SqlConnection
Dim Connection As String = "MyConnectionString"
Con.Open()
Dim Cmd As SqlCommand = Con.CreateCommand()
Cmd.CommandType = CommandType.StoredProcedure
Cmd.CommandText = QueryName
Cmd.Parameters.AddWithValue("user", UserName)
Cmd.Parameters.AddWithValue("password", Password)
Dim da As New SqlDataAdapter(Cmd)
Dim ds As New DataTable()
da.Fill(ds)
Return ds
End Using
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Using
End Function
Sub ShowStudentInfo()
Dim dt As DataTable = GetInfoForStudent("MyStoredProcName", "MyUserName", "MyPasswword")
' Since (presumably) only one is returned
With dt.Rows(0)
' Assign your text boxes
'LoginIDTextBox.Text = .Item("LoginID")
'StudentNameTextBox.Text = .Item("Student Name")
'StudentAddressTextBox.Text = .Item("Student address")
'StudentIDTextBox.Text = .Item("StudentID")
End With
End Sub
あなたはチュートリアルを見てする必要があります。あなたの質問は、おそらく意図せず、広すぎる – Tahbaza