Ask a Question related to ASP Database, Design and Development.
-
Madge #1
Update database without submit button (single page code) ASP
Please help.
Trying to update a record using ASP but within a single page i.e. no
submit button. Code below.
Thanks in advance - ASP Novice!
<%
Dim objRS__MMColParam
objRS__MMColParam = "1"
If (Request.Form("cartId") <> "") Then
objRS__MMColParam = Request.Form("cartId")
End If
%>
<%
Dim whichOne
'here we are getting the number from the URL
whichOne = Request.QueryString("Country")
If whichOne = "GB" Then
'if whichOne is one we do this
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = MM_INVITE_CON1_STRING
objRS.Source = "SELECT * FROM tblSessions WHERE OrderRef = '" +
Replace(objRS__MMColParam, "'", "''") + "'"
objRS.CursorType = 0
objRS.CursorLocation = 2
objRS.LockType = 1
objRS.Open()
objRS_numRows = 0
' Now updating records
objRS("PayName") = Request.QueryString("name")
objRS.Update
ElseIf whichOne = "US" Then
'if whichOne is two we do this
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = MM_INVITE_CON1_STRING
objRS.Source = "SELECT * FROM tblSessionsUS WHERE OrderRef = '" +
Replace(objRS__MMColParam, "'", "''") + "'"
objRS.CursorType = 0
objRS.CursorLocation = 2
objRS.LockType = 1
objRS.Open()
objRS_numRows = 0
ElseIf whichOne = "CA" Then
'if whichOne is three we do this
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = MM_INVITE_CON1_STRING
objRS.Source = "SELECT * FROM tblSessionsCA WHERE OrderRef = '" +
Replace(objRS__MMColParam, "'", "''") + "'"
objRS.CursorType = 0
objRS.CursorLocation = 2
objRS.LockType = 1
objRS.Open()
objRS_numRows = 0
Else
'otherwise we tell them they did not make a choice
Response.Write "You did not make a choice, go back and do so now."
End If
%>
<%
objRS.Close()
Set objRS = Nothing
%>
Madge Guest
-
Single & Double Quote Problem in Database Insert/Update
Hello, I have a textarea on a form where users are able to enter text wrapped in 'single' and "double" quotes. However, when I insert or update... -
Update multiple rows data with a single button
hello I have been trying to run multiple update queries based on the data entered by user. Brief background: I am fetching data from various... -
what in the code makes a .gif a submit button
How do I make a normal .gif into a submit button that will hold action? ie. <input type='submit' name='Submit' value='Submit'> when I put the src... -
html code to update web page
Hi I am new to Macromedia Dreamweaver and also to html. I have html pages which link to files on our network. What I need help with is some code... -
multiple grids on one page - use single Update/Edit/Cancel commands
Hi - can you access the grid id from DataGridCommandEventArgs ? I have multiple similar grids on the one page, and want to use the same events to... -
Jeff Cochran #2
Re: Update database without submit button (single page code) ASP
On 23 Jun 2004 08:58:43 -0700, [email]matt@lazertype.co.uk[/email] (Madge) wrote:
Gotta submit it somehow. The page as rendered resides on the client.>Please help.
>
>Trying to update a record using ASP but within a single page i.e. no
>submit button. Code below.
ASP on a server has no way of knowing the client has done anything
unless some client-side code is activated that posts to the server,
either clicking a Submit button on a form with an action, or through a
client side script.
Jeff
>Thanks in advance - ASP Novice!
>
><%
>Dim objRS__MMColParam
>objRS__MMColParam = "1"
>If (Request.Form("cartId") <> "") Then
> objRS__MMColParam = Request.Form("cartId")
>End If
>%>
>
><%
>Dim whichOne
>'here we are getting the number from the URL
>whichOne = Request.QueryString("Country")
>If whichOne = "GB" Then
>'if whichOne is one we do this
>
>Set objRS = Server.CreateObject("ADODB.Recordset")
>objRS.ActiveConnection = MM_INVITE_CON1_STRING
>objRS.Source = "SELECT * FROM tblSessions WHERE OrderRef = '" +
>Replace(objRS__MMColParam, "'", "''") + "'"
>objRS.CursorType = 0
>objRS.CursorLocation = 2
>objRS.LockType = 1
>objRS.Open()
>
>objRS_numRows = 0
>
> ' Now updating records
> objRS("PayName") = Request.QueryString("name")
> objRS.Update
>
>ElseIf whichOne = "US" Then
>'if whichOne is two we do this
>
>Set objRS = Server.CreateObject("ADODB.Recordset")
>objRS.ActiveConnection = MM_INVITE_CON1_STRING
>objRS.Source = "SELECT * FROM tblSessionsUS WHERE OrderRef = '" +
>Replace(objRS__MMColParam, "'", "''") + "'"
>objRS.CursorType = 0
>objRS.CursorLocation = 2
>objRS.LockType = 1
>objRS.Open()
>
>objRS_numRows = 0
>ElseIf whichOne = "CA" Then
>'if whichOne is three we do this
>
>Set objRS = Server.CreateObject("ADODB.Recordset")
>objRS.ActiveConnection = MM_INVITE_CON1_STRING
>objRS.Source = "SELECT * FROM tblSessionsCA WHERE OrderRef = '" +
>Replace(objRS__MMColParam, "'", "''") + "'"
>objRS.CursorType = 0
>objRS.CursorLocation = 2
>objRS.LockType = 1
>objRS.Open()
>
>objRS_numRows = 0
>Else
>'otherwise we tell them they did not make a choice
>Response.Write "You did not make a choice, go back and do so now."
>End If
>%>
>
><%
>objRS.Close()
>Set objRS = Nothing
>%>Jeff Cochran Guest
-
Bullschmidt #3
Re: Update database without submit button (single page code) ASP
<<
Trying to update a record using ASP but within a single page...Don't know if this might hopefully give you any ideas:>>
ASP Design Tips - Post Back Page
[url]http://www.bullschmidt.com/devtip-postbackpage.asp[/url]
Or this piece of JavaScript that can used client-side and put on an
onclick or onchange or whatever:
document.myform.submit();
Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
[url]http://www.Bullschmidt.com[/url]
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex [url]http://www.devdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Bullschmidt Guest
-
IPT #4
Re: Update database without submit button (single page code) ASP
Possible, as you use querystring.
Check at your objRS.LockType = 1 for update. This is wrong.
Type 1 is read-only. You need to use other type. I can't recall which, but I
guess they are 4 types all together. You can try use objRS.LockType = 2 for
update.
> Please help.
>
> Trying to update a record using ASP but within a single page i.e. no
> submit button. Code below.
>
> Thanks in advance - ASP Novice!
IPT Guest



Reply With Quote

