Charles p

Charles p

  • NA
  • 17
  • 0

storing information from a sql stored precedure to variable in vb.net 2005

Jul 30 2008 2:03 PM

Hi,

I am trying to pass a parameter username to a stored procedure in SQL and get 1 row back with 3 columns.  Then i want to assign the 3 columns values to 3 diffrent variables and send them back to the call.  can some1 please help me?  here is what i got so far:

Public Sub GetEmpInfo(ByRef ManagerName As String, ByRef mEmail As String, ByRef dept As String, ByVal username As String)

Dim strGetUserName As String = username

Dim MyCommand As New SqlCommand("sp_aspx_mrt_EmpInfo", mySQLConnection)

MyCommand.Parameters.Add("@NTlogin", SqlDbType.VarChar, 50).Value = strGetUserName

MyCommand.CommandType = CommandType.StoredProcedure

Dim MyDataAdapter As New SqlDataAdapter(MyCommand)

Dim myDataSet As New DataSet

MyDataAdapter.Fill(myDataSet)

ManagerName = CType(MyCommand.ExecuteScalar, String)

End Sub


this code was originally to put the info in a drop down list, but now i am trying to put the info into vaiables instead.

 

Please, please help.

 

-Charles


Answers (6)