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.EventArg s) Handles MyBase.Load
Dim cn As New ADODB.Connectio n
Dim Rs As ADODB.Recordset
cn.Open("Driver =SQL
Server;Server=x xxxx;Database=x xxxx;uid=xxxxx; pwd=xxxxx;")
Rs = New ADODB.Recordset
Rs.Open("Exec MyRecords" & "'" & Session("valTyp e") & "'" & ", '" &
Session("valTC" ) & "'" & ", '" & Session("valLan g") & "'", cn)
Session("valSer ial") = Rs.Fields("Seri al").Value
Dim RsPending As ADODB.Recordset
RsPending = New ADODB.Recordset
RsPending.Open( "Exec StatusPending " & "'" & Session("valSer ial") &
"'", cn, ADODB.CursorTyp eEnum.adOpenKey set,
ADODB.LockTypeE num.adLockOptim istic)
lblSSN.Text = Rs.Fields("SSN" ).Value
lblBWE.Text = Rs.Fields("Proc Date").Value
lblDate.Text = Rs.Fields("Rece ieveDate").Valu e
lblTime.Text = Rs.Fields("Proc essTime").Value
lblLang.Text = Rs.Fields("Lang uage").Value
lblUser.Text = Rs.Fields("User ").Value
End Sub
Private Sub btnNext_Click(B yVal sender As Object, ByVal e As
System.EventArg s) Handles btnNext.Click
Dim objConn As SqlConnection = New SqlConnection(" Data
Source=xxxxxxx; UID=xxxxx;PWD=x xxxx;")
Dim objStatusComple teCMD As SqlCommand = New
SqlCommand("Sta tusComplete", objConn)
objStatusComple teCMD.CommandTy pe = CommandType.Sto redProcedure
Dim PSerialNo As SqlParameter =
objStatusComple teCMD.Parameter s.Add("@Serial" , SqlDbType.Char, 12)
PSerialNo.Value = Session("valSer ial")
objConn.Open()
Dim myStatusC As SqlDataReader =
objStatusComple teCMD.ExecuteRe ader()
myStatusC.Read( )
myStatusC.Close ()
myStatusC = Nothing
objConnStatus.C lose()
objConnStatus = Nothing
End Sub 2 1052
Hi Ken,
Have a look at "IsPostBack "
(It has to be in your page load event, every time a page is sended back it
is completly initialized).
Normaly the sentence in the load event from a webform is.
If not IsPostback then
...........
else
End if
As an advice, have also a look at the dataset, in my opinion you do not have
to change your code that much for it.
I hope this helps,
Cor 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.EventArg s) Handles MyBase.Load Dim cn As New ADODB.Connectio n Dim Rs As ADODB.Recordset cn.Open("Driver =SQL Server;Server=x xxxx;Database=x xxxx;uid=xxxxx; pwd=xxxxx;")
Rs = New ADODB.Recordset Rs.Open("Exec MyRecords" & "'" & Session("valTyp e") & "'" & ", '"
& Session("valTC" ) & "'" & ", '" & Session("valLan g") & "'", cn)
Session("valSer ial") = Rs.Fields("Seri al").Value Dim RsPending As ADODB.Recordset RsPending = New ADODB.Recordset RsPending.Open( "Exec StatusPending " & "'" & Session("valSer ial")
& "'", cn, ADODB.CursorTyp eEnum.adOpenKey set, ADODB.LockTypeE num.adLockOptim istic)
lblSSN.Text = Rs.Fields("SSN" ).Value lblBWE.Text = Rs.Fields("Proc Date").Value lblDate.Text = Rs.Fields("Rece ieveDate").Valu e lblTime.Text = Rs.Fields("Proc essTime").Value lblLang.Text = Rs.Fields("Lang uage").Value lblUser.Text = Rs.Fields("User ").Value
End Sub
Private Sub btnNext_Click(B yVal sender As Object, ByVal e As System.EventArg s) Handles btnNext.Click
Dim objConn As SqlConnection = New SqlConnection(" Data Source=xxxxxxx; UID=xxxxx;PWD=x xxxx;") Dim objStatusComple teCMD As SqlCommand = New SqlCommand("Sta tusComplete", objConn) objStatusComple teCMD.CommandTy pe = CommandType.Sto redProcedure
Dim PSerialNo As SqlParameter = objStatusComple teCMD.Parameter s.Add("@Serial" , SqlDbType.Char, 12) PSerialNo.Value = Session("valSer ial")
objConn.Open()
Dim myStatusC As SqlDataReader = objStatusComple teCMD.ExecuteRe ader() myStatusC.Read( )
myStatusC.Close () myStatusC = Nothing
objConnStatus.C lose() objConnStatus = Nothing
End Sub
Thank you very much! That worked!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rachel |
last post by:
Hi all,
I am new in ASP.Net. I have a question on link multiple web forms together.
Here is the scenario:
I create an Index.aspx WebForm which consists of a banner and three navigator buttons as well as a body to load the content. It is exactly like a normal HTML page where there are banner, menu bar, and body to load content. In my case, there are three .aspx WebForms which I have to link them together in the Index.aspx page. So that...
|
by: Paul R |
last post by:
Hi,
I have a Winforms application that access some SQLServer2000 stored
procedures.
I have now written some new Webforms pages to use some of the same stored
procs. The Webforms use the SAME data access classes (all of my business
logic and data access classes are in DLLs that are shared between the
Winforms and Webforms).
|
by: Netserver |
last post by:
Hi have a question hope there is a simple answer. I want to enter data
in to 2 arrays from several webforms in project and be able to recall
that data from any of the webforms, other then using a querystring
I tried creating a module as follows
Module dataspecs
Public ar1(0) As Integer
Public ar2(0) As Integer
End Module
|
by: |
last post by:
All the fields in webforms are automatically declared as protected.
If I change them to public, they are converted back to protected.
Why is this happening ?
Thanks
|
by: Martin Rosén-Lidholm |
last post by:
Although an impossible question to answer, I fell urged to raise it anyhow.
Given a fairly complex ERP application scenario, what's your estimation for
the X-ratio
dev. time for WebForms app
| |
by: Piotr Karwatka |
last post by:
Hi!
I have a little problem an qeustion.
In .NET Windows Forms I can do something like that:
- i have forms - Form1 Form2, on first form i have TextBox1 control on 2nd
form I have Button1 control
- on second Form i can acces data from Form1 like that:
for example: MessageBox.Show(Form1.TextBox1.Text);
|
by: Joergen Bech |
last post by:
Trying to implement my own webforms designer to be hosted
in a WinForms environment.
Basically: I know that mshtml is used in the VS.Net 2003 WebForms
designer, but the HTML behind the scenes is not the same as what
is found on the HTML tab, i.e.
<asp:CheckBox id=" ...
would be translated to something like
|
by: 3Cooks |
last post by:
I have a windows application written in Visual Basic 6.0 that is going
to be redeveloped in dotNET. We are trying to decide if we should
deploy using Webforms or Winforms and I need advice from someone who is
not on my team.
The VB 6.0 application is used by approximately 100 users. All users
reside in-house. There is an existing external website that will use
some of the same components but the two applications are separate.
The...
|
by: dwight |
last post by:
Hi all
First - I apologise if anyone recognises this from a previous post but
I never worded what I wanted to know properly and getting quick advice
is imperative to me now. In future I will never cross post but time is
a factor now and I appreciate any advice I have recieved
I am looking for some advice on when it is best to create a database
entry and management application using .net winforms or webforms
|
by: Bit byte |
last post by:
Can I use C# (Winforms) to design a website?. I am from C/C++ background
but know nothing about Internet programming.
My understanding of WebForms are that they are similar to WinForms in
that they give a WYSIWYG environment for designing user interfaces -
however, all searches I have done on WebForms display the actual HTML,
not a WYSIWYG environment.
My questions (finally) then are.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |