ALTER PROCEDURE InsertTaskHeader ( @task_no int, @project_id int, @lkup_id int, @descrip text, @start_date datetime, @status_id int, @userid char(10), @taskhdr_id OUTPUT ) AS INSERT INTO task_header(task_no, project_id, lkup_id, descrip, start_date, status_id, timestamp_created, userid_created) VALUES (@task_no, @project_id, @lkup_id, @descrip, @start_date, @status_id, getdate(), @userid) SELECT @taskhdr_id = SCOPE_IDENTITY() RETURNand in your code, to call the SP, you'd need to set the parameter's direction, like this:
'Webform calling the stored procedure Private Sub setInsertTaskHeaderParameters() With Me.daTaskHeader.InsertCommand Me.getMaxTaskNo() .Parameters("@task_no").Value = txtTaskno.Text .Parameters("@project_id").Value = cboProjects.SelectedItem.Value .Parameters("@lkup_id").Value = daStatus.SelectCommand.Parameters("@lkup_id").Value .Parameters("@descrip").Value = Me.txtDescrip.Text .Parameters("@start_date").Value = CType(Me.txtStartDate.Text, DateTime) .Parameters("@status_id").Value = Me.cboStatus.SelectedItem.Value .Parameters("@userid").Value = Session("username") ' I think I got the syntax right here .Parameters.Add("@taskhdr_id") .Parameters.Direction = ParameterDirection.InputOutput; End With End SubHTH,
>'Webform calling the stored procedure > Private Sub setInsertTaskHeaderParameters() > With Me.daTaskHeader.InsertCommand > Me.getMaxTaskNo() > .Parameters("@task_no").Value = txtTaskno.Text > .Parameters("@project_id").Value = cboProjects.SelectedItem.Value > .Parameters("@lkup_id").Value = daStatus.SelectCommand.Parameters("@lkup_id").Value > .Parameters("@descrip").Value = Me.txtDescrip.Text > .Parameters("@start_date").Value = CType(Me.txtStartDate.Text, DateTime) > .Parameters("@status_id").Value = Me.cboStatus.SelectedItem.Value > .Parameters("@userid").Value = Session("username") > End With > End Sub > >'Stored Procedure >ALTER PROCEDURE InsertTaskHeader >( > @task_no int, > @project_id int, > @lkup_id int, > @descrip text, > @start_date datetime, > @status_id int, > @userid char(10) >) >AS >INSERT INTO task_header(task_no, project_id, lkup_id, descrip, start_date, status_id, timestamp_created, userid_created) >VALUES (@task_no, @project_id, @lkup_id, @descrip, @start_date, @status_id, getdate(), @userid) > RETURN >