I am making a project on student attendance register in vb.net2005 with sql2000 server as backend.
I am getting the data at runtime from database in data grid viewer. But if a user wants to edit a record, i want to give rights that he is able to edit only particular column(Like he can edit attendance on particular date but not roll no or name).
I have to submit this project in cllg within few days.
Can someone pls help me with this. How to achieve this.any help will be appreciated.

thx in advance

Also, i have 33 columns in my table(Roll no, Name, and 31 dates)
1) Is there any method that i can update my table in backend data base through data gridview. Can y pls provide a code or a link for the same?

2) Even if there is code can it be achieved without using "set" sqlquiery becoz there will be lot of "set" then, and /or no way to know what all column has been changed.

3)Is it possible to create a new table(s) in db automatically at the end of every month.

4) can someone pls help me with how to copy the fields of a table into another table

for editing only particular column write this code

urGridName.Columns(1).ReadOnly = True

1 is the index of the column of which you don't want to edit through this code column 1 is turn into readable only user cann't edit that column.

You can make any column read only.

you cann't update your table without using set.

Thx for replying.
Also like u mentioned we cant update using set command. Is there any way that in one instruction/coding i can update my database at back end according to whatever changes has been made in data grid viewer. The changes made is unknown to us. it depends on the user and accordingly db can be updated.
Thx in advance.

for that you have to give update button to the user and for update button you can give code as follows

you write this code on update button click event

this code is for MySql server

for i as integer=0 to DataGridView1.Rows.count-1
Dim cmd As MySqlCommand = New MySqlCommand()
                    cmd.Connection = New MySqlConnection(urDatabaseConnectionString)
                    cmd.CommandText = "update yourTableName set yourField1='" & DataGridView1.Rows(i).Cells(1).Value & "', 
yourField2='" & DataGridView1.Rows(i).Cells(2).Value & "'"
                    dr = cmd.ExecuteReader()
                    MessageBox.Show("Record Saved")
next  i
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.