943,694 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 534
  • VB.NET RSS
Apr 19th, 2009
0

vvurgent help required...regarding datagrid viewer

Expand Post »
Hi.
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
Last edited by premanjanadas; Apr 19th, 2009 at 11:58 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
premanjanadas is offline Offline
5 posts
since Oct 2008
Apr 19th, 2009
0

Re: urgent help required...regarding datagrid viewer

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
thx
Reputation Points: 10
Solved Threads: 0
Newbie Poster
premanjanadas is offline Offline
5 posts
since Oct 2008
Apr 20th, 2009
0

Re: urgent help required...regarding datagrid viewer

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.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
guest11 is offline Offline
59 posts
since Nov 2007
Apr 20th, 2009
0

Re: urgent help required...regarding datagrid viewer

you cann't update your table without using set.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
guest11 is offline Offline
59 posts
since Nov 2007
Apr 23rd, 2009
0

Re: urgent help required...regarding datagrid viewer

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
premanjanadas is offline Offline
5 posts
since Oct 2008
Apr 24th, 2009
0

Re: urgent help required...regarding datagrid viewer

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

VB.NET Syntax (Toggle Plain Text)
  1. this code is for MySql server
  2.  
  3. for i as integer=0 to DataGridView1.Rows.count-1
  4. Dim cmd As MySqlCommand = New MySqlCommand()
  5. cmd.Connection = New MySqlConnection(urDatabaseConnectionString)
  6. cmd.CommandText = "update yourTableName set yourField1='" & DataGridView1.Rows(i).Cells(1).Value & "',
  7. yourField2='" & DataGridView1.Rows(i).Cells(2).Value & "'"
  8. cmd.Connection.Open()
  9. dr = cmd.ExecuteReader()
  10. MessageBox.Show("Record Saved")
  11. cmd.Connection.Close()
  12. next i
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
guest11 is offline Offline
59 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Insert icon In ListView Column Header
Next Thread in VB.NET Forum Timeline: vb6 hough transform





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC