By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Help with Webforms

P: n/a
Ken
Hello,

I have a webform that gets a record from SQL Server by using a stored
procedure.
The stored procedure uses 3 parameters in which after the record is found,
stored procedure #2 runs to update one of the columns called Status from
"incomplete" to "Pending"
Status is one of the parameters for stored procedure #1.
This all works fine, My problem is after the person is finished with the
record they then push the next button to get the next record.
Prior to gettting the next record I need it to execute stored procedure #3
to update the Status column from "Pending" to "Complete"
What it is doing is its getting the next record and then running stored
procedure #3 which causes the new record to be updated instead of the
previous.

Any help would be greatly appreciated!
CODE:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim cn As New ADODB.Connection
Dim Rs As ADODB.Recordset

cn.Open("Driver=SQL
Server;Server=xxxxx;Database=xxxxx;uid=xxxxx;pwd=x xxxx;")

Rs = New ADODB.Recordset
Rs.Open("Exec MyRecords" & "'" & Session("valType") & "'" & ", '" &
Session("valTC") & "'" & ", '" & Session("valLang") & "'", cn)
Session("valSerial") = Rs.Fields("Serial").Value

Dim RsPending As ADODB.Recordset
RsPending = New ADODB.Recordset
RsPending.Open("Exec StatusPending " & "'" & Session("valSerial") &
"'", cn, ADODB.CursorTypeEnum.adOpenKeyset,
ADODB.LockTypeEnum.adLockOptimistic)
lblSSN.Text = Rs.Fields("SSN").Value
lblBWE.Text = Rs.Fields("ProcDate").Value
lblDate.Text = Rs.Fields("ReceieveDate").Value
lblTime.Text = Rs.Fields("ProcessTime").Value
lblLang.Text = Rs.Fields("Language").Value
lblUser.Text = Rs.Fields("User").Value

End Sub
Private Sub btnNext_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Dim objConn As SqlConnection = New SqlConnection("Data
Source=xxxxxxx;UID=xxxxx;PWD=xxxxx;")
Dim objStatusCompleteCMD As SqlCommand = New
SqlCommand("StatusComplete", objConn)
objStatusCompleteCMD.CommandType = CommandType.StoredProcedure

Dim PSerialNo As SqlParameter =
objStatusCompleteCMD.Parameters.Add("@Serial", SqlDbType.Char, 12)
PSerialNo.Value = Session("valSerial")

objConn.Open()

Dim myStatusC As SqlDataReader =
objStatusCompleteCMD.ExecuteReader()
myStatusC.Read()

myStatusC.Close()
myStatusC = Nothing

objConnStatus.Close()
objConnStatus = Nothing

End Sub

Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JEP
Cool question Ken, you are obviously a guru. I don't have a clue as to an answer for you. But, you could answer my question, one below yours re: SQLDataAdapter.Update. That way, Karma will have somebody give you a good answer fast.
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.