C# + Access Database Problem

A

ATXTech

I am using a Access created database with a program I wrote in C# to
create and track helpdesk tickets. I store basic stuff like customer
name, number, issue, tech assigned, etc. with in the database.

**PROBLEM**
The database worked fine in saving and displaying records until it
reaced the 26th record. When ever you open the ticket program, it
retrieves the data from the database on the server and shows the last
entry in the database first. For example the tickets show like this:
28,27,26,1,2,3,4...How do I get it to show the last ticket entered at
the end. The actual database when opened in Access looks fine and
displays the tickets in the order they where entered
(1,2,3...25,26,27). It's only when the "program" displays the records
does it appear the way it does. It's like it reads the last records
first and then the first one on down. Please help!! Thank you!
 
G

Gordon Smith \(eMVP\)

ATXTech said:
I am using a Access created database with a program I wrote in C# to
create and track helpdesk tickets. I store basic stuff like customer
name, number, issue, tech assigned, etc. with in the database.

**PROBLEM**
The database worked fine in saving and displaying records until it
reaced the 26th record. When ever you open the ticket program, it
retrieves the data from the database on the server and shows the last
entry in the database first. For example the tickets show like this:
28,27,26,1,2,3,4...How do I get it to show the last ticket entered at
the end. The actual database when opened in Access looks fine and
displays the tickets in the order they where entered
(1,2,3...25,26,27). It's only when the "program" displays the records
does it appear the way it does. It's like it reads the last records
first and then the first one on down. Please help!! Thank you!

It sounds like you don't have your result set sorted. Saying how to help is
hard since I don't know how exactly you retrieved your result set. If based
off of the base table directly, you need to specify an index to use for
ordering. If based off of a query, you'd want to have an ORDER BY in your
query string. etc.
 
A

ATXTech

Gordon said:
It sounds like you don't have your result set sorted. Saying how to help is
hard since I don't know how exactly you retrieved your result set. If based
off of the base table directly, you need to specify an index to use for
ordering. If based off of a query, you'd want to have an ORDER BY in your
query string. etc.

I am just using a basic Access table. I am using customerDataSet,
customersBindingSource, cutomersTableAdapter in C# to load and display
my table. I did see a "sort" property for customerBindingSource and
when I told it to sort by "Ticket ID" (the ticket number) it worked! I
guess since my primary key was "Ticket ID" and it was set to auto
increment, when I told it to sort by that, it sorted them in ascending
order and now it seems to work (or at least with the database on the
local machine). I will put the database back on the server later today
and see what happens. I am asuming that what I did is sort of what you
where saying, either way thank you for your hekp.
 
B

BlackWasp

I am guessing this is not just a case of a missing ORDER BY statement in
your SQL statement?

Can you post the code you are using to get the data from Access so we can
comment?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top