I have using the import data view to load at the Grid and i want to make certain column to be readonly but i set the code but it cant work. And i using the import data view method how i update the data to the database.Note: ASP.net 2002,SQL server
Below is the code that i click the button then load the data to the grid
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim dataTable1 As DataTable
Dim oleDbConnection1 As System.Data.OleDb.OleDbConnection
Dim oleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter
Dim oleDbSelectCommand1 As System.Data.OleDb.OleDbCommand
oleDbConnection1 = New OleDbConnection()
oleDbDataAdapter1 = New OleDbDataAdapter()
oleDbSelectCommand1 = New OleDbCommand()
oleDbConnection1.ConnectionString = "Provider=sqloledb;User ID=sa ; pwd=123321; Data Source=ndtkomagsvr; Initial Catalog=spcdb"
oleDbSelectCommand1.Connection = oleDbConnection1
oleDbDataAdapter1.SelectCommand = oleDbSelectCommand1
dataTable1 = New DataTable()
dataTable1.Reset()
Try
oleDbSelectCommand1.CommandText = "SELECT (select t.Testtype_Name from SPC_Sputter_Testtype t where t.Testtype_Id = c.Testtype_Id)as Testtype_Name,(select ct.Charttype_Name from SPC_Sputter_Charttype ct where ct.Charttype_Id = c.Charttype_Id)as Charttype_Name,LSL,LCL,Target,UCL, USL, Rule1,Rule2, Rule3,Rule4,Offset,Intevac_Target_Prod FROM SPC_Sputter_ControlLimits_New c where Prod_type = '" & ddlProduct.SelectedItem.Value & "' and Sputter_Id = '" & ddlLine.SelectedItem.Value & "'"
oleDbDataAdapter1.Fill(dataTable1)
Finally
oleDbConnection1.Close()
End Try
' Clears datasheets first.
GridWeb1.WebWorksheets.Clear()
' Imports data from dataview object.
GridWeb1.WebWorksheets.ImportDataView(dataTable1.DefaultView, Nothing, Nothing)
GridWeb1.ShowHeaderBar = False
GridWeb1.WebWorksheets(0).Cells.SetColumnReadonly(0, True) ***cant work
GridWeb1.WebWorksheets(0).Cells.SetColumnReadonly(1, True) **** cant work
End Sub
*** first column and second column still can edit.
I no want the two column editable jsut only readonly
And how to uisng like that method to update the data to database
Hope someone can help me.
Thanks.