Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.NET / Database question

VB.NET / Database question

Scheduled Pinned Locked Moved Visual Basic
questioncsharpdatabasecom
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tom Wright
    wrote on last edited by
    #1

    in my code Private Sub logonBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logonBtn.Click 'Validate logon username and password. Dim myresult As Integer myresult = Me.TeacherTableAdapter.usernamePassword(PasswordTextBox.Text, UsernameTextBox.Text) If myresult = 0 Then MessageBox.Show("Logon Error; Username or Password is incorrect") Exit Sub End If MessageBox.Show("Welcome to Teachers Pet") Call LoadMainScreen() End Sub What if I wanted to return back more than one item...for instance, right now it's returning the user ID, what if I wanted, userID, TGrade, FullName? Would I just return everything back in an array? Thanks.....and if this is the wrong board and should be on the ADO.NET then let me know and I'll delete this and move it there.

    Tom Wright tawright915@gmail.com

    J S 2 Replies Last reply
    0
    • T Tom Wright

      in my code Private Sub logonBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logonBtn.Click 'Validate logon username and password. Dim myresult As Integer myresult = Me.TeacherTableAdapter.usernamePassword(PasswordTextBox.Text, UsernameTextBox.Text) If myresult = 0 Then MessageBox.Show("Logon Error; Username or Password is incorrect") Exit Sub End If MessageBox.Show("Welcome to Teachers Pet") Call LoadMainScreen() End Sub What if I wanted to return back more than one item...for instance, right now it's returning the user ID, what if I wanted, userID, TGrade, FullName? Would I just return everything back in an array? Thanks.....and if this is the wrong board and should be on the ADO.NET then let me know and I'll delete this and move it there.

      Tom Wright tawright915@gmail.com

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      Hi Tom, By the look of it I think it might actually be reasonably easy (but no guarantees): Private Sub logonBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logonBtn.Click 'Validate logon username and password. Dim myresult() As String myresult = Me.TeacherTableAdapter.usernamePassword(PasswordTextBox.Text, UsernameTextBox.Text) If myresult.GetValue(0) = 0 Then MessageBox.Show("Logon Error; Username or Password is incorrect") Exit Sub End If MessageBox.Show("Welcome to Teachers Pet") Call LoadMainScreen() End Sub

      Tom Wright wrote:

      userID, TGrade, FullName

      It looks like you want to return data of different types, so the array would best be made of type String. You can then use the data from the myresult array with .GetValue(0-based index number here) and convert values from the string type to integer, etc. where needed. As I don't know the code on the Me.TeacherTableAdapter.usernamePassword(PasswordTextBox.Text, UsernameTextBox.Text) side, your on your own making it return multiple values. Hope this helps, Johan

      My advice is free, and you may get what you paid for.

      1 Reply Last reply
      0
      • T Tom Wright

        in my code Private Sub logonBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logonBtn.Click 'Validate logon username and password. Dim myresult As Integer myresult = Me.TeacherTableAdapter.usernamePassword(PasswordTextBox.Text, UsernameTextBox.Text) If myresult = 0 Then MessageBox.Show("Logon Error; Username or Password is incorrect") Exit Sub End If MessageBox.Show("Welcome to Teachers Pet") Call LoadMainScreen() End Sub What if I wanted to return back more than one item...for instance, right now it's returning the user ID, what if I wanted, userID, TGrade, FullName? Would I just return everything back in an array? Thanks.....and if this is the wrong board and should be on the ADO.NET then let me know and I'll delete this and move it there.

        Tom Wright tawright915@gmail.com

        S Offline
        S Offline
        SimulationofSai
        wrote on last edited by
        #3

        Looks like you're using some tool to generate the Datalayer. If this is true, just change the underlying SP that is executed by Me.TeacherTableAdapter.usernamePassword() function to return a resultset instead of just a string output. And run the tool again. This will make the function return a DataRow of the underlying table. If the above is not true, you've to start from the ground up. Modify the SP to return a resultset, modify the function to read the resultset using a DataReader or a DataSet. SG

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups