W
Will
I have a small problem which I am sure is easily resolved but my lack of ASP
experience is holdng me back so I'm hoping someone can assist.
I have a very simple procedure which involves a user updating a field value
on an ASP.Net page, clicking a button which then kicks off an SQL stored
procedure to update the underlying table. The problem is the update is being
ignored, there are no error messages. If I run the procedure from query
analyser it works.
My code is:
Dim myParam1 As New SqlParameter("@cancType", SqlDbType.VarChar)
myParam1.Direction = ParameterDirection.Input
myParam1.Value = txtCancType.Text
Dim myParam3 As New SqlParameter("@cNum", SqlDbType.Int)
myParam3.Direction = ParameterDirection.Input
myParam3.Value = cint(session("myID")
Dim daReg As New SqlDataAdapter
daReg.SelectCommand = New SqlCommand
daReg.SelectCommand.Connection = SqlConn2
daReg.SelectCommand.CommandText = "updateDetails2"
daReg.SelectCommand.CommandType = CommandType.StoredProcedure
daReg.SelectCommand.Parameters.Add(myParam1)
daReg.SelectCommand.Parameters.Add(myParam3)
SqlConn2.Open()
daReg.SelectCommand.ExecuteNonQuery()
SqlConn2.Close()
And the stored procedure is:
CREATE PROCEDURE dbo.updateDetails2
@cancType varchar(50),
@cNum int
As
update PatientDetails
set cancType = @cancType--,basics_FK = @basicsFK
where basics_FK = @cNum
GO
In the PatientDetails table the basics_FK field is set up as "int".
Any/all constructive suggestions appreciated.
Thanks
WW
experience is holdng me back so I'm hoping someone can assist.
I have a very simple procedure which involves a user updating a field value
on an ASP.Net page, clicking a button which then kicks off an SQL stored
procedure to update the underlying table. The problem is the update is being
ignored, there are no error messages. If I run the procedure from query
analyser it works.
My code is:
Dim myParam1 As New SqlParameter("@cancType", SqlDbType.VarChar)
myParam1.Direction = ParameterDirection.Input
myParam1.Value = txtCancType.Text
Dim myParam3 As New SqlParameter("@cNum", SqlDbType.Int)
myParam3.Direction = ParameterDirection.Input
myParam3.Value = cint(session("myID")
Dim daReg As New SqlDataAdapter
daReg.SelectCommand = New SqlCommand
daReg.SelectCommand.Connection = SqlConn2
daReg.SelectCommand.CommandText = "updateDetails2"
daReg.SelectCommand.CommandType = CommandType.StoredProcedure
daReg.SelectCommand.Parameters.Add(myParam1)
daReg.SelectCommand.Parameters.Add(myParam3)
SqlConn2.Open()
daReg.SelectCommand.ExecuteNonQuery()
SqlConn2.Close()
And the stored procedure is:
CREATE PROCEDURE dbo.updateDetails2
@cancType varchar(50),
@cNum int
As
update PatientDetails
set cancType = @cancType--,basics_FK = @basicsFK
where basics_FK = @cNum
GO
In the PatientDetails table the basics_FK field is set up as "int".
Any/all constructive suggestions appreciated.
Thanks
WW