Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

selecting data from SQL database

$
0
0

Hello

I have the following code

Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("AnalyticalNewConnectionString").ConnectionString)
            conn.Open()
            Using cmd As SqlCommand = conn.CreateCommand
                cmd.CommandText = "select Sample_ID, PO_Number from New_analysis_data where RFA_number =" & RFA_number_box.Text

                Dim sqlrd As SqlDataReader = cmd.ExecuteReader()

                While sqlrd.Read()

                    Me.sample_ID.Text = "Sample_ID"
                    Me.purchase_order.Text = "PO_Number"


                End While

            End Using
        End Using

It basically should read a database (sql server 2008) and then return the two fields into 2 textboxes based on a variable I enter.  It occurs on a button click. 

All I get though it the words sample_id and PO_Number in the textboxes. Help!


Viewing all articles
Browse latest Browse all 23244

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>