I am developing a windows based application in vb.net 2005 and data base is SQL2000 I have database named new base and table name is Trick and fields are ItId, ItName, ItPrice, ItQuantity, itstock
Problem is that I want to populate data gridview through search data from text box but only field names display and data is not displayed in datagridview can any one help me
This is the code I am using……..
Imports System.Data.SqlClient
Imports System.Data.Sql
Imports System.Data.SqlTypes
Public Class SearchItem
Dim currRec = 0
Dim totalrec = 0
Dim dt As New DataTable
Dim ds As New DataSet()
Private Sub btnsea_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsea.Click
Dim ConnectionString As String = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=NewBase;Data Source=ROCK"
Dim conn As New SqlConnection(ConnectionString)
Dim cmdstr As String = "Select * from trick where ItName = '& txtsea.text &'"
Dim DataAdapter As New SqlDataAdapter(cmdstr, conn)
DataAdapter.Fill(ds)
conn.Close()
DGVList.DataSource = (ds.Tables(0))
End Sub
Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click
End
End Sub
End Class