Hello,
I am currently using Visual Basic 2005 express edition with a MS Access database. I have made a "Contacts" Form, where the user will be able to enter a members surname and press an OK button, this then searches through the database and displays the results in the corresponding text boxes (ID, FirstName, LastName etc) of the searched member. I have used an SQL statement to search through the database, the problem I am having is filling the text boxes (ID, FirstName, LastName etc) with the correct member.
Below is my search code:
Private Sub BtnOK_Click(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles BtnOK.Click
Dim inc As Integer
Dim maxrows As Integer
Dim con As New OleDb.OleDbConn ection
Dim ds As New DataSet
Dim da As OleDb.OleDbData Adapter
con.ConnectionS tring = "PROVIDER=Micro soft.Jet.OLEDB. 4.0;Data Source = C:\Documents and Settings\My Documents\Visua l Studio 2005\Projects\B ugReport\BugRep ort\Issues Database.MDB"
con.Open()
Dim str As String
str = "SELECT * FROM Contacts WHERE FirstName = '" & TextSearch.Text & "'"
da = New OleDb.OleDbData Adapter(str, con)
da.Fill(ds, "Contacts")
con.Close()
ID.Text = ds.Tables("Cont acts").Rows(0). Item(0)
FirstName.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(1))
LastName.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(2))
EmailAddress.Te xt = GetTextField(ds .Tables("Contac ts").Rows(0).It em(3))
Company.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(4))
JobTitle.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(5))
BusinessPhone.T ext = GetTextField(ds .Tables("Contac ts").Rows(0).It em(6))
HomePhone.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(7))
MobilePhone.Tex t = GetTextField(ds .Tables("Contac ts").Rows(0).It em(8))
FaxNumber.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(9))
Address.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(10))
City.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(11))
StateProvince.T ext = GetTextField(ds .Tables("Contac ts").Rows(0).It em(12))
ZIPPostalCode.T ext = GetTextField(ds .Tables("Contac ts").Rows(0).It em(13))
CountryRegion.T ext = GetTextField(ds .Tables("Contac ts").Rows(0).It em(14))
WebPage.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(15))
Notes.Text = GetTextField(ds .Tables("Contac ts").Rows(0).It em(16))
maxrows = ds.Tables("Cont acts").Rows.Cou nt
inc = 0
End Sub
Thanks in Advance
2 1573
I think the problem is within the text box related code rather than the SQL statment, as when I click OK the text boxes are always filled with the details of the first record.
Hi, just wondering if anyone could help me with the correct way to fill the textboxes.
Thanks
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: QLD_AU |
last post by:
Has anyone see the following error ?
VS 2005 Installs ok, however the SQL Mobile Edition (part of a full install)
fails with the following error ?
With Thanks
Jason
|
by: Andrew Robinson |
last post by:
My main dev machine has WinXp and VS2005 (pro).
1. I need to install VWD Express Edition so that I can do some instruction
on this. Any issues with both on the same machine. Installation order?
2. Does VWD Express Edition support the idea of Solutions? I coun't figure
out how to create a blank solution which I usually do with VS2005 (and then
add my web site to the solution.)
|
by: Progman |
last post by:
I have Visual Studio 2005 Standard edition.
Is ti the same thing as the Express edition or Standard is more?
|
by: Pitaridis Aristotelis |
last post by:
Is there any way to create setup for a project made in Microsoft Visual
Basic 2005 Express Edition
|
by: Hunk Gym |
last post by:
VB.Net of Visual Studio.Net 2003 VS Visual Basic 2005 Express Edition
Good Day!
Would be appreciate if there is solution for the following problem:
- In VB.Net of Visual Studio.Net 2003, developer can click and drag a table
listed in the Server Explorer from a connected database to the form. This
will add OleDbConnection control and OleDbDataAdapter control to the form .
Developer can also Click Data -Generate Dataset to generate...
| |
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |