0

Please Help me to solve that i just wana to search Data feilds from SQL Database and to show on different TExtboxes of VB.net forms.....

Dim Bio As New DataSet
        Dim Marks As New DataSet
        Dim Disp As New SqlDataAdapter
        Dim Dispp As New SqlDataAdapter

        Dim Bind As New BindingSource

        Dim Slec As New SqlDataAdapter
        Dim Slc As New SqlDataAdapter

        Try

            Slec.SelectCommand = New SqlCommand("SELECT Name = '" & txtname.Text & "' FROM Student_BioData WHERE Seat# = '" & txtseat.Text & "' ", sqlconn)
            Bio.Clear()
            Bind.DataSource = Marks.Tables(0)
            Disp.Fill(Bio, "Student_BioData")


            Slc.SelectCommand = New SqlCommand("SELECT Book# = '" & TxtBKN.Text & "' FROM Marksheet WHERE Seat# = '" & txtseat.Text & "' ", sqlconn)
            Marks.Clear()
            Bind.DataSource = Marks.Tables(0)
            Dispp.Fill(Marks, "Marksheet")


            '            Slec.SelectCommand = New SqlCommand("SELECT Name'=" & txtname.Text & "', CNIC#='" & txtcnic.Text & "', F_Name='" & txtfname.Text & "', College='" & txtdept.Text & "', Academic_Year='" & txtacad.Text & "' where Seat#='" & txtacad.Text & "' FROM Student_BioData ", sqlconn)

            '           Slc.SelectCommand = New SqlCommand("SELECT Book#='" & TxtBKN.Text & "', Certificate#='" & TXTCERT.Text & "',CS='" & txtsub1.Text & "',DE='" & txtsub2.Text & "',HRM='" & txtsub3.Text & "',CT='" & txtsub4.Text & "',OOP='" & txtsub5.Text & "',DS='" & txtsub6.Text & "',Obtained='" & obt.Text & "',Percentage='" & Perc.Text & "',Grade='" & grad.Text & "',Result='" & result.Text & "' FROM Marksheet", sqlconn)

            sqlconn.Open()
            Slec.SelectCommand.ExecuteNonQuery()
            Slc.SelectCommand.ExecuteNonQuery()

            sqlconn.Close()

        Catch ex As Exception

            MessageBox.Show(ex.Message, "Connection to sql server Failed Please Check Connection Proprly")

        End Try
2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Hardosh Kumar
0

You need to use either datareader or dataadapter methods to get the data from DB and then assign to textboxes by looping through ur dataset or datareader.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.