Question SQL Data base fields OR Collumns on the Textboxes

Hardosh Kumar

New member
Joined
Jul 24, 2011
Messages
1
Programming Experience
1-3
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
 
Last edited by a moderator:
A couple of suggestions:

- Wrap your code in [ CODE ][ /CODE ] tags (drop the spaces from inside the brackets)
- Drop a few carriage returns into your code
- add a question to your post rather than expect folk here to second guess your problem
 
Back
Top