Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

datagrid view help

sukysuky Posts: 2Member
hi everyone. i just joined.

i have run into a problem while doing a search program. please help me.

i am trying to search a database and return the results in a datagrid view. my webform contains a text box txtsearch and a button btnSearch and a datagrid view grdoutput. the problem is i can not get anything to display. here is the code

[code]Imports System.Data
Imports System.data.OleDb

Partial Class search
Inherits System.Web.UI.Page
Dim myDataTable As New DataTable

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim strSQL As String

strSQL = "select Pin from Credentials where Gpa > " & txtSearch.Text & ""

Dim conConnection As New OleDbConnection
conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=" & System.AppDomain.CurrentDomain.BaseDirectory() & "App_Datash.mdb"
conConnection.Open()

Dim myDataAdapter As New OleDbDataAdapter(strSQL, conConnection)

myDataAdapter.Fill(myDataTable)
grdoutput.DataSource = myDataTable

conConnection.Close()
myDataAdapter.Dispose()
End Sub

End Class[/code]

can someone please help?




Comments

Sign In or Register to comment.