Can you guys please tell me whats wrong on my code. Im trying to get the data of Title, Author, Price, Stock from DB and output it on my textboxes.

  Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        connstring = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Csrp2_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
        conn.ConnectionString = connstring

        If TextBox6.Text = form1.TextBox6.Text Then
            sql = "SELECT from Csrp2_table1 (Title, Author, Price, Stock) Values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')"

        End If

        Dim da As New SqlDataAdapter(sql, conn)

    End Sub

Or do you guys think im missing this code

" WHERE RFID = '" textbox6.text " ' " 

but where should i put it???

you want to show output from the database and show it in your textbox ? if yes then you can use sqldatareader for this.


I think you want print it data in text box then you have to use the code like This

   myConnection = New SqlConnection(connectionstring)

        myCommand = New SqlCommand(" Select (Coloums) FROM (Table) Where P_Id='" & TextBox3.Text & "'", myConnection)
        Dim dr As SqlDataReader = myCommand.ExecuteReader
        While dr.Read()
' In here put textbox to retrive the data from the tabb\le
            TextBox4.Text = Val(dr(0))

            'currentbalance = Double.Parse(dr(2).ToString)

        End While

Hey Dili1234 thank you so much for the effort posting that code. But i already got it to worked, found some code somewhere posted by CodeRaker. I appreciate your effort. Thanks a lot.