473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

export a sorted datagrid

juve11
20
hi,
i want to export to access a sorted datagrid. i managed to sort the datagrid but when i make the export, the mdb file it's without the sort.
Nov 1 '07 #1
5 1561
It could be an easy solution to use an Excel sheet to save sorted and copy out again. By this the index number can change to the sorted order as well.

You can do the same by saving it to CSV and copying out again (but better not try it with OpenOffice formats, my machine usually stalls if I try to use these directly).

By using CSV you can also exceed 65,556 lines if necessary.
Nov 1 '07 #2
Killer42
8,435 Expert 8TB
... i managed to sort the datagrid but when i make the export, the mdb file it's without the sort.
Are you sure? Access returns records in the sequence you request, or (I think) defaults to the sequence of the primary key. The physical order in which the records are stored in a database is usually of little or no importance.
Nov 2 '07 #3
juve11
20
i am making the sort in datagrid,then i insert the rows to access

for i to datagridview1.rowcount
insert into..... values datagridview1.rows(i).cells(0)
next

doesnt work.also i am making a test:

msgbox(datagridview.rows(13).cells(0) -> and this message shows the correct (with sort) row.
Nov 2 '07 #4
Killer42
8,435 Expert 8TB
Yes, but what do you mean when you say that Access loses the sort? As I said, when you retrieve the records from the database, Access doesn't necessarily return them in the order you stored them. It depends on things such as:
  • The SQL you use,
  • The table's primary key, and
  • Joins between tables.
Nov 2 '07 #5
debasisdas
8,127 Expert 4TB
i am making the sort in datagrid,then i insert the rows to access

for i to datagridview1.rowcount
insert into..... values datagridview1.rows(i).cells(0)
next
When you are inserting records to the database, there is no guarantee that it will store the records in the sequence you have inserted. This is true for all databases. If you want to retrieve from the database you can always sort them logically as per your requirement.
Nov 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Oliver Drobnik | last post by:
Hi, I have a datagrid bound to a datatable. Now if I sort the datagrid by clicking on one of the column heads I can no longer use the index in the datagrid to find the corresponding row in the...
3
by: sam | last post by:
Hello group, The datagrid is sorted using a dataview. Can I get the sorted dataview or table from the datagrid or any other way. All I need to get is the sorted data. Here is my code and what I am...
5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
5
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value...
2
by: Bidarkota | last post by:
Hi, I have a DataGrid in which there are some images and Data are displayed and in the webform.asp page i am using some stylesheets. when i export the datagrid all the images are also exported...
3
by: Bidarkota | last post by:
When i export DataGrid to Excel all the HTML contents are also exporting to excel. i am using stylesheets in the ASPX Page and i am getting an alert message that stylesheets are missing. i need to...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
0
by: kieran | last post by:
Hi, I have an 'export to excel' button on my Datagrid. All works well except that on my Datagrid, I have sub total rows. The subtotal rows use colspan so that the subtotals are given above...
5
by: karthick | last post by:
Hi, I am exporting a Gridview to Excel and it works fine without any issues. But as one of the field holds values such as "71646E100" it gets converted to: "7.16E+104" (like a formula) in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.