Hi Experts,
I got these designed from Visual Studio .NET
- sqlconnection1
- sqlDataAdapter1
- DsProblemDesc1
my stored proc:
Create Procedure ProblemDesc_Sp
@ProblemID Integer
AS
SELECT ProblemID, ProblemDesc
FROM ProblemTbl
WHERE ProblemID = @ProblemID
on my webform1.aspx, I got a textbox txtProblemDesc and bound to the above dataset and it works fine.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myProblemID = Request.QueryString("ProblemID")
SqlDataAdapter1.SelectCommand.Parameters("@ProblemID").Value = CInt(myProblemID)
SqlDataAdapter1.Fill(DsProblemDesc1)
txtProblemDesc.text = DsProblemDesc1.Tables(0).Rows(0)("ProblemDesc")
End Sub
I would like my users be able to edit the "Problem Description" directly from the textbox and then click Save to save the new text into database. I tried this:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
DsProblemDesc1.Tables(0).Rows(0)("ProblemDesc") = txtProblemDesc.text
SqlDataAdapter1.Update(DsProblemDesc1)
End Sub
but it does not update the database at all, still keeping the old "problem description".
Is there simple way to do this?
I tried both datagrid and UPDATE stored proc, but none of them seems works for me. Please help!
Thanks a whole bunch in advance.
I got these designed from Visual Studio .NET
- sqlconnection1
- sqlDataAdapter1
- DsProblemDesc1
my stored proc:
Create Procedure ProblemDesc_Sp
@ProblemID Integer
AS
SELECT ProblemID, ProblemDesc
FROM ProblemTbl
WHERE ProblemID = @ProblemID
on my webform1.aspx, I got a textbox txtProblemDesc and bound to the above dataset and it works fine.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myProblemID = Request.QueryString("ProblemID")
SqlDataAdapter1.SelectCommand.Parameters("@ProblemID").Value = CInt(myProblemID)
SqlDataAdapter1.Fill(DsProblemDesc1)
txtProblemDesc.text = DsProblemDesc1.Tables(0).Rows(0)("ProblemDesc")
End Sub
I would like my users be able to edit the "Problem Description" directly from the textbox and then click Save to save the new text into database. I tried this:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
DsProblemDesc1.Tables(0).Rows(0)("ProblemDesc") = txtProblemDesc.text
SqlDataAdapter1.Update(DsProblemDesc1)
End Sub
but it does not update the database at all, still keeping the old "problem description".
Is there simple way to do this?
I tried both datagrid and UPDATE stored proc, but none of them seems works for me. Please help!
Thanks a whole bunch in advance.