S
Sharon
Hello All,
Is it possible to update Sql Table through DataGrid. I have a DataGrid
which is being populated through a stored procedure, all i wanted to do
is to update one field (FieldName-Authorised) which has a datatype bit
through DataGrid but not sure how to go about it. Any Ideas Guys on
this one, your help is greatly appreciated.
This is the procedure used to populate the datagrid, The primary key
for the table is EntryID which is displayed on the datagrid. I need to
update only one column based on the entryid, is that possible.
Private Sub FillData()
Dim username As String
username = lblUser.Text.Trim
Try
Dim cmd2 As New SqlClient.SqlCommand
cmd2.CommandText = "c_sp_manager_access"
cmd2.CommandType = CommandType.StoredProcedure
cmd2.Connection = SqlConnection1
cmd2.Parameters.Clear()
Dim myparam As New SqlClient.SqlParameter
myparam.ParameterName = "@UserName"
myparam.Direction = ParameterDirection.Input
myparam.SqlDbType = SqlDbType.VarChar
myparam.Value = username
cmd2.Parameters.Add(myparam)
SqlDataAdapter1.SelectCommand = cmd2
SqlDataAdapter1.Fill(DataSet31, "c_sp_manager_access")
DataGrid1.DataBind()
Catch ex As Exception
Dim debug As String = ex.Message
lblfeedback.Text = ex.Message
End Try
End Sub.
I have written a stored procedure to update the column, it takes the
following parameters
EntryID, Authorised(Value either True or False), EditedBy(String).
Now how do i use this stored procedure in the datagrid to update my sql
table. Please advice.
Thanks in Advance, Shilpa.
Is it possible to update Sql Table through DataGrid. I have a DataGrid
which is being populated through a stored procedure, all i wanted to do
is to update one field (FieldName-Authorised) which has a datatype bit
through DataGrid but not sure how to go about it. Any Ideas Guys on
this one, your help is greatly appreciated.
This is the procedure used to populate the datagrid, The primary key
for the table is EntryID which is displayed on the datagrid. I need to
update only one column based on the entryid, is that possible.
Private Sub FillData()
Dim username As String
username = lblUser.Text.Trim
Try
Dim cmd2 As New SqlClient.SqlCommand
cmd2.CommandText = "c_sp_manager_access"
cmd2.CommandType = CommandType.StoredProcedure
cmd2.Connection = SqlConnection1
cmd2.Parameters.Clear()
Dim myparam As New SqlClient.SqlParameter
myparam.ParameterName = "@UserName"
myparam.Direction = ParameterDirection.Input
myparam.SqlDbType = SqlDbType.VarChar
myparam.Value = username
cmd2.Parameters.Add(myparam)
SqlDataAdapter1.SelectCommand = cmd2
SqlDataAdapter1.Fill(DataSet31, "c_sp_manager_access")
DataGrid1.DataBind()
Catch ex As Exception
Dim debug As String = ex.Message
lblfeedback.Text = ex.Message
End Try
End Sub.
I have written a stored procedure to update the column, it takes the
following parameters
EntryID, Authorised(Value either True or False), EditedBy(String).
Now how do i use this stored procedure in the datagrid to update my sql
table. Please advice.
Thanks in Advance, Shilpa.