Click here to Skip to main content
15,886,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Respected Sir,

I am using

datagridview.datasource=datatable.copy
to populate data which has no linking datasource at all.


In that case, why am I unable to edit a cell ?


1) Below Query Let Not Change the VB.Net Datagridview Cell Content:

strSQL = "Select Row_Number() Over (Order By A.Id) As SN, A.Id, A.Face As [Object Name],B.Visi,B.AddNew,B.Edit,B.Del,B.Prnt,B.Reg,B. XL,B.Txt,B.Email from MSG_URightMaster A " strSQL = strSQL & "Left Join MSG_URight B On A.Id=B.RightId Where B.UserId='" & flxGroup(flxGroup.Row, 1) & "' "


2) I have also used below query which is perfect and I am able to change any cell content:

DIM strSQL as string Below Query Let Change the VB.Net Datagridview Cell Content: strSQL = "Select Row_Number() Over (Order By A.Id) As SN, A.Id, A.Face As [Object Name], " strSQL = strSQL & "(Select B.Visi From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As Visi, " strSQL = strSQL & "(Select B.AddNew From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As AddNew, " strSQL = strSQL & "(Select B.Edit From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As Edit, " strSQL = strSQL & "(Select B.Del From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As Del, " strSQL = strSQL & "(Select B.Prnt From MSG_URight B Where A.Id=B.RightId And B.UserId='" &a
mp; flxGroup(flxGroup.Row, 1) & "') As Prnt, " strSQL = strSQL & "(Select B.Reg From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As Reg, " strSQL = strSQL & "(Select B.XL From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As XL, " strSQL = strSQL & "(Select B.Txt From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As Txt, " strSQL = strSQL & "(Select B.Email From MSG_URight B Where A.Id=B.RightId And B.UserId='" & flxGroup(flxGroup.Row, 1) & "') As Email " strSQL = strSQL & "From MSG_URightMaster A Order By A.ID "


I am so confused. Could you please advise why?


Kindly suggest to me what's the problem between queries that I am not able to change cell content.


Regards-
Sanjeeb</pre>
Posted
Comments
Thava Rajan 1-Apr-14 6:27am    
please edid your question and post in the code tag then only we will able to analyse your code
dimpledevani 1-Apr-14 9:40am    
Try Datatable dt1=datatable.copy;
grid.DataSource=dt1;

1 solution

My question, to further understand your question, would be why are you copying the table. My experience is to just bind to a new instance.

VB
Dim dt as New DataTable
dt = datatable

grid.Datasource = dt


That should allow a read/write instance for manipulation purposes.
 
Share this answer
 
Comments
Sanjeeb38 4-Apr-14 0:02am    
Dear Sir,

This approach is bound mode.

And I want to work in unbound mode.

There is even a method in unbound mode i.e populating every rows one-by-one which is very slow in case of millions of records.

If possible, please help me to achieve the output I required.


Regards-
Sanjeeb

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900