urgent help required...regarding datagrid viewer

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 5
Reputation: premanjanadas is an unknown quantity at this point 
Solved Threads: 0
premanjanadas premanjanadas is offline Offline
Newbie Poster

vvurgent help required...regarding datagrid viewer

 
0
  #1
Apr 19th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 5
Reputation: premanjanadas is an unknown quantity at this point 
Solved Threads: 0
premanjanadas premanjanadas is offline Offline
Newbie Poster

Re: urgent help required...regarding datagrid viewer

 
0
  #2
Apr 19th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 58
Reputation: guest11 is an unknown quantity at this point 
Solved Threads: 2
guest11 guest11 is offline Offline
Junior Poster in Training

Re: urgent help required...regarding datagrid viewer

 
0
  #3
Apr 20th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 58
Reputation: guest11 is an unknown quantity at this point 
Solved Threads: 2
guest11 guest11 is offline Offline
Junior Poster in Training

Re: urgent help required...regarding datagrid viewer

 
0
  #4
Apr 20th, 2009
you cann't update your table without using set.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 5
Reputation: premanjanadas is an unknown quantity at this point 
Solved Threads: 0
premanjanadas premanjanadas is offline Offline
Newbie Poster

Re: urgent help required...regarding datagrid viewer

 
0
  #5
Apr 23rd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 58
Reputation: guest11 is an unknown quantity at this point 
Solved Threads: 2
guest11 guest11 is offline Offline
Junior Poster in Training

Re: urgent help required...regarding datagrid viewer

 
0
  #6
Apr 24th, 2009
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

  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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC