Public Class Form1
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim dr As OleDb.OleDbDataReader
Private Sub SearchBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchBtn.Click
If firstnameTxtBx.Text = " " Then
Me.firstnameTxtBx.Text = "SELECT First_Name FROM Employee Info WHERE First_Name = firstnametxtbx.text"
con.Close()
If Me.resultsTxtBx.Text <> "SELECT * FROM Employee Info WHERE First_Name = firstnametxtbx.text" Then
Me.resultsTxtBx.Text = "No Record Found"
End If
Else
Me.resultsTxtBx.Text = Me.firstnameTxtBx.Text & " " & Me.lastnameTxtBx.Text
End If
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dbProvider = "Provider=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source = C:\Documents and Settings\ldyer\Desktop\IDPhotoProgram\Photos.mdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM Employee Info"
da = New OleDb.OleDbDataAdapter(sql, con)
End Sub
End Class
searching within an access database
Page 1 of 18 Replies - 717 Views - Last Post: 14 July 2011 - 01:08 PM
#1
searching within an access database
Posted 14 July 2011 - 08:13 AM
Hey everyone. Needing some help here. I haven't programmed in over a year and I am trying to get this to work. I have a sample database containing 4 columns (First_Name, Last_Name, Emp_Num, and Image). I wanting to type my search criteria in a textbox and search the access database by first and last names. Once the record is found I am wanting to display the name and image for that person. I have already linked my database to my project Any pointers????
Replies To: searching within an access database
#2
Re: searching within an access database
Posted 14 July 2011 - 08:43 AM
I am a little confused on what you are doing in your code. The general format is:
Here are some great tutorials to refresh yourself with:
OleDb Basics in VB.Net Rate Topic
A Really Simple Database Create a Database using Access & VB.net Express 2008
- connection string
- sql string
- connection object
- open connection object
- sql command created with connection and sql command
- execute command
- dataset
- take results from a read or adapater and shove into the dataset
- close connection
- manipulate data in dataset!
Here are some great tutorials to refresh yourself with:
OleDb Basics in VB.Net Rate Topic
A Really Simple Database Create a Database using Access & VB.net Express 2008
#3
Re: searching within an access database
Posted 14 July 2011 - 11:49 AM
thanks for the links. i am trying to go through the second one right now. im trying to add the button and it is not visible when i hit run.
This post has been edited by zipty05: 14 July 2011 - 11:50 AM
#4
Re: searching within an access database
Posted 14 July 2011 - 11:52 AM
I don't know what you mean by "the button".
#5
Re: searching within an access database
Posted 14 July 2011 - 11:56 AM
Sorry.
In the second tutuorial it says add a button to Form1 and the code for that button show be.
Form2.Show()
When I do this no button is visible while the program is running. I didn't touch any of the properties of the button and I even tried to add to the code,
Me.searchBtn.visible = True
But still no button shows.
In the second tutuorial it says add a button to Form1 and the code for that button show be.
Form2.Show()
When I do this no button is visible while the program is running. I didn't touch any of the properties of the button and I even tried to add to the code,
Me.searchBtn.visible = True
But still no button shows.
#6
Re: searching within an access database
Posted 14 July 2011 - 12:15 PM
How did you add the button?
#7
Re: searching within an access database
Posted 14 July 2011 - 12:16 PM
Dragged it from the toolbox.
#8
Re: searching within an access database
Posted 14 July 2011 - 12:19 PM
Delete it and add a new one.
It sounds like your borked the designer somewhere along the way.
It sounds like your borked the designer somewhere along the way.
#9
Re: searching within an access database
Posted 14 July 2011 - 01:08 PM
Okay. I will try that.
Thank you for your help.
Thank you for your help.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|