Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataReader Issue
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
DataReader Issue
Divers
Thread ID:
00765602
Message ID:
00765602
Vues:
46
Hi all,


I encountered a weird issue while executing a stored procedure that returns only one record and I assign the result to a datareader.
Here is the issue: before I call datareader.read() I can see the value of a the columns in the debug window. Once I call datareader.Read(), this returns false and I cannot get the record returned by the stored procedure.
Any input is appreciated.

Thanks,

Vlad
Here is the code:
sqlCon = New SqlConnection(ConfigurationSettings.AppSettings("connString"))
                sqlCon.Open()
                sqlCmd = New SqlCommand()
                sqlCmd.CommandType = CommandType.StoredProcedure
                sqlCmd.CommandText = "proc_getAgentInfo" ' returns only one record
                param = sqlCmd.Parameters.Add("@id", SqlDbType.Int, 4)
                param.Direction = ParameterDirection.Input
                param.Value = Integer.Parse(Request("id").ToString())
                sqlCmd.Connection = sqlCon

                rs = sqlCmd.ExecuteReader()

                Do While rs.Read()
                    lastname = rs("Name")
                Loop
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform