Hey, As you can see i have a function to retrieve the product description based on product code. For some reason this is refusing to return a value even though the value im entering into test is there in the table, i can see the value of the input enters fine, but by the end the string is empty.
Plsssss help looked at the same code for 3 days now lol
Private Function GetProductFromProductTable(ByVal product As String) As String
Dim productDescription As String = String.Empty
Using Myconnection As New SqlConnection()
Myconnection.ConnectionString = ConfigurationManager.ConnectionStrings("EDIconnectionString").ConnectionString
Dim mycommand As New SqlCommand()
mycommand.Connection = Myconnection
mycommand.CommandText = "SELECT Long_description FROM Stock WHERE Product = @Product"
mycommand.Parameters.AddWithValue("@Product", product)
Myconnection.Open()
Dim dr2 As SqlDataReader = Nothing
dr2 = mycommand.ExecuteReader()
dr2.Read()
While dr2.Read()
productDescription = Convert.ToString(dr2("Long_description"))
End While
dr2.Close()
Myconnection.Close()
Return productDescription
End Using
End Function