Hi there,
I'm fairly new to using databases with VB .NET. I'm currently working on an application using a Microsoft Access database as a data source. I have created a form to display the fields for each record in a particular table (using the feature that allows you to drag and drop a field from a table in the database onto the form, automatically attaching a BindingNavigato r and TableAdapter and all that jazz to it). As you probably know, when the application is run the form will display all records in the table.
What I want to be able to do is find particular records in the table and display only these records on the previously mentioned form (there will be at least one record, but occasionally more).
I can successfully find the records I need from the database, but I can't seem to get the form to display only those records. Instead, it still displays ALL of the records in the table.
Currently, I am retrieving the relevant records from the database then storing them in an array of objects (and this works fine). I retrieve the row number of the first object in the array (I was just trying to get one working first) and then set the myBindingSource .Position property to that row number. However, this does nothing, and as I said the form still shows all of the records in the table (starting at the first record) rather than the required record. I'm also not sure how to go about limiting the number of records displayed.
I don't really know what options are available for me to get this working. I would appreciate any help at all at this stage.
Cheers,
dheroan
1 2856
Hi there,
I'm fairly new to using databases with VB .NET. I'm currently working on an application using a Microsoft Access database as a data source. I have created a form to display the fields for each record in a particular table (using the feature that allows you to drag and drop a field from a table in the database onto the form, automatically attaching a BindingNavigato r and TableAdapter and all that jazz to it). As you probably know, when the application is run the form will display all records in the table.
What I want to be able to do is find particular records in the table and display only these records on the previously mentioned form (there will be at least one record, but occasionally more).
I can successfully find the records I need from the database, but I can't seem to get the form to display only those records. Instead, it still displays ALL of the records in the table.
Currently, I am retrieving the relevant records from the database then storing them in an array of objects (and this works fine). I retrieve the row number of the first object in the array (I was just trying to get one working first) and then set the myBindingSource .Position property to that row number. However, this does nothing, and as I said the form still shows all of the records in the table (starting at the first record) rather than the required record. I'm also not sure how to go about limiting the number of records displayed.
I don't really know what options are available for me to get this working. I would appreciate any help at all at this stage.
Cheers,
dheroan
why are you not using sql???
a simple select query with your condition will do everything..... ..
take a DataSet(say ds)...fill dataset with a DataAdapter(say da).......Populate a Datagrid or Gridview or Table with your DataSet
i am giving you a code snippet in VB.NET......... ......... -
-
Dim sqlString As String="Select myrecord FROM myTable WHERE myColumn=myCondition"
-
da = New OleDbDataAdapter(sqlString , myConnection)
-
ds = New DataSet
-
da.Fill(ds)
-
dg.DataSource=ds
-
dg.DataBind()
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dan |
last post by:
Hello,
I'm getting started on my first java project. I'm likely going to use
jsp/servlets connected to javabeans. The beans will connect to my
backend and get/set information for me. When returning database
records from the bean, what common methods to people use? I've seen
records returned as arraylists, but I'm not sure I like this method
too well. To get the information in the next column, I can use
nextElement(), but then I'm...
|
by: Carlo Chung |
last post by:
How to use db-lib to update/insert database records without using SQL
language. I want to change the value of the data individually without
plugging in the new values in the SQL language then execute it. The
perfect situation for me is loop through the retrieved records then
edit the values individually until EOF.
Thanks,
Carlo
|
by: Richard Holliingsworth |
last post by:
Hello:
I'm building a report to display statistics on the entire database. I
have successfully built a report that groups the entire db on one field
and gives me a count of db records for the categories in that field and
a total record count for the db.
Now, I need to add another "total database" grouping to get another set
of record counts. I DO NOT want to nest this group, It MUST consider
ALL database records.
|
by: alsemgeest |
last post by:
Hi,
I'd like to make a valuation of database records. Suppose you have a
table:
Name Must have
Address Should have
Zip Should have
SocialSecNr Must have
City Should have
|
by: Peter |
last post by:
Hello£¬everyone,
My program will collect a testing machine's data ,save the data and deal
with the data everyday. I want to use vb.net to create database, add and
delete tables or modify the records in the database.
Is it possible to create a SQL Server database using vb.net? I know I can
use vb.net and ADOX to create a Access database. But I can't create SQL
database using vb.net.
| |
by: Lindsey Howell |
last post by:
Hello,
I've encountered a problem when trying to display BLOB images from a SQL
database using VB.NET. This is the code which generates the error:
Dim mySqlConnection As SqlConnection = New
SqlConnection(connectionString)
Dim mySqlCommand As SqlCommand = New SqlCommand(queryString,
mySqlConnection)
Dim ms as MemoryStream = New MemoryStream
|
by: rodchar |
last post by:
hey all,
what's the best way to get database records into an array?
thanks,
rodchar
|
by: Jay |
last post by:
i post a while back on how to page thru database records. i dont really understand the ASPFAQ one. Its not well commented. This is how i learn anything, is if its commented on what does what.
Can someone please help me. i have a datbase of about 90 records so far, that i would like to page thru.
Thank you.
James Jones
|
by: Ronald Raygun |
last post by:
I need to dynamically create a page that allows me to edit records in a
a database table. Basically, something very similar to how PHP MyAdmin
works only slighly less complicated. There does not need to be the
ability to edit the structure of the database or tables or anything like
that, simply a listing of the records and the ability to either
edit/delete or create a new record in the table.
I have searched google for a long time but...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |