473,386 Members | 1,705 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,386 software developers and data experts.

adding row numbers to datagrid

jamesd0142
469 256MB
Hi again!

Please see image...

I have retrieved this information from my database, i now want to add a row number to each row that is added...

any ideas?

Cheers
Sep 19 '07 #1
3 1724
hariharanmca
1,977 1GB
You have to do it in insert query or set a autonumber in database table.
Sep 19 '07 #2
Hi again!

Please see image...

I have retrieved this information from my database, i now want to add a row number to each row that is added...

any ideas?

Cheers
hi!!
can u plz tell me how you have retrieved the entries from the database in a datagrid by coding

TIA
regards
vishwas
Sep 19 '07 #3
jamesd0142
469 256MB
at the top of the form below the public class

'connect to database
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=FAQs.mdb"
Dim selectCommand As String

'create datasets
Dim dataSetView As New DataSet
Dim dataSetQuestion As New DataSet
Dim dataSetAnswer As New DataSet


Dim dataAdapter As New OleDb.OleDbDataAdapter(selectCommand, connectionString)
Dim commandBuilder As New OleDb.OleDbCommandBuilder(dataAdapter)


Inside a button or on frm load put:

dgvAnswer.DataSource = ""
dataSetAnswer.Clear()
selectCommand = "SELECT * FROM tblAnswer Order By Answer_Id"
dataAdapter.SelectCommand.CommandText = selectCommand
dataAdapter.Fill(dataSetAnswer, "AnswerView")
dgvAnswer.DataSource = dataSetAnswer.Tables("AnswerView")

DONT FORGET TO PUT YOUR DATABASE IN YOUR PROJECT FOLDER!
I put mine in bid\debug although i have been told this is bad practice.
Sep 19 '07 #4

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

Similar topics

10
by: sp0 | last post by:
Is there a reason why to make mix numbers improper when adding? It seems when subtracting and adding, adding a subtracting the whole numbers and fraction parts should be sufficient? what'ch think
2
by: Jim | last post by:
In my Win App, I have a datagrid that's bound to a dataset. When the form loads, the datagrid fills. How can I add an empty row to the end of the datagrid during a button click (similar to...
2
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete...
3
by: Steve B. | last post by:
How to I get the relating table Text entries to show in the datagrid instead of the corresponding relating table row id numbers? The DataMember/DataSet of the DataGrid is a relational MS-Access...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple...
1
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple...
1
by: .Net Sports | last post by:
I'm trying to display the total of a list of numbers in a datagrid. The numbers (dollaramount in sales) will be part of a dataset according to the date queried. I will display the total in the...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
17
by: Sri | last post by:
How do you add an n-bit number in C? Regards, Sri
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
jinu1996
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...

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.