Hi it's me again, still working on the sam 5 minute problem so feeling kind of thick now.
I've dumped the idea of using a textarea for now and am using a textbox instead but am struggling when it comes to updating the database, I've tried several different methods and the one I'm currently battling with is as follows: - %
-
set objconn=server.CreateObject("ADODB.connection")
-
objconn.Mode=3
-
objconn.Open ("DSN=localserver; User ID=blah; Password=blah; DATABASE=blah; APP=ASP Script")
-
set rs2=objconn.execute ("SELECT EmailType from Grades_email_tbl")
-
%>
-
<%
-
Dim strEmailType
-
strEmailType = Request.Form("Select1")
-
%>
-
<form method="post" action="email.asp">
-
-
<select name=select1>
-
-
<%do while not rs2.eof %>
-
<option><%=rs2(0)%></option>
-
<%
-
rs2.movenext
-
loop
-
rs2.Close
-
set rs2 = nothing
-
%>
-
</select>
-
<%
-
Dim query
-
query = "SELECT emailContents FROM Grades_email_tbl WHERE EmailType ='"&strEmailType&"'"
-
set rs3 = server.createObject("ADODB.recordset")
-
rs3.LockType =3
-
rs3.open query, objConn
-
-
%>
-
<input type=Submit value=Go! />
-
-
-
Email type selected: <%=strEmailType%>
-
<br />
-
</form>
-
<form method="post" action="emails_edit.asp" >
-
<input name="no" type="hidden" value= <%=strEmailType%>>
-
<table>
-
-
<input id="Text3" style="width: 200px" value=<%=rs3("emailContents")%> type="text" name="Text3" />
-
-
</table>
-
-
<input type="submit" name="action" value="Save">
-
</form>
-
<form name= "form2" method=post>
-
-
<tr><td align="center" colspan="8">
-
<%
-
''Dim emailtxt
-
''emailtxt= ("&Request.Form("Text1")")
-
''Response.write bah("&Request.Form("emailtxt")&")
-
''rs3("emailContents")=Request.Form ("emailtxt.value")
-
''rs3.Update
-
%><input type="submit" value="Send" name="submit1" style="width: 50px">
-
</td></tr>
-
</table>
-
-
</body></html>
-
-
-
<%
-
set objdb=nothing
-
objconn.Close
-
set objconn=nothing
-
%>
Then the emails_edit.asp looks like: - <%@ Language=VBScript %>
-
<%Option Explicit%>
-
-
<html>
-
<body>
-
<%
-
Dim BolFound, rs4
-
Dim con2
-
set con2=server.CreateObject("ADODB.connection")
-
con2.Open ("DSN=localserver; User ID=blah; Password=blah; DATABASE=blah; APP=ASP Script")
-
set rs4=server.CreateObject("ADODB.recordset")
-
rs4.LockType =3
-
rs4.Open "Grades_email_tbl", con2, &H0001
-
-
BolFound=false
-
-
Do while not (rs4.eof or BolFound)
-
If(strComp(rs4("emailType"), request("strEmailType"), vbtextcompare)=0) then
-
BolFound= True
-
Else
-
rs4.movenext
-
End if
-
Loop
-
rs4("emailContents")= Request.Form("text3")
-
rs4.update
-
rs4.Close
-
set rs4=nothing
-
set Con2=nothing
-
con2.close
-
-
%>
-
-
</body>
-
</html>
-
The select box works fine and when I hit the go button it loads the value of emailContents into my textbox, but when I his the Save button under the textbox I just get errors, the current one being a 'BOF or EOF is True" error so I'm guessing I'm not passing the values accross correctly, infact I've just confirmed that by trying to response.write r4("emailConten ts") so now I'm totally stumped
3 1796
I think I've cracked it, a piece of code that didn't work when I tried it now seems to work. -
<%@ Language=VBScript %>
-
<%Option Explicit%>
-
-
-
<%
-
Dim rs4, con2, strEmailType, Query2
-
strEmailType = request.Form("emails")
-
Query2 = "Select * from grades_email_tbl where emailtype ='"&strEmailType&"'"
-
set con2=server.CreateObject("ADODB.connection")
-
con2.Open ("DSN=localserver; User ID=blah; Password=blah; DATABASE=blah; APP=ASP Script")
-
set rs4=server.CreateObject("ADODB.recordset")
-
rs4.LockType =3
-
rs4.Open Query2, con2, &H0001
-
rs4("emailContents")= Request.Form("emailtxt")
-
rs4.update
-
rs4.Close
-
set rs4=nothing
-
-
con2.close
-
set Con2=nothing
-
Response.Write "Your e-mail has been saved"
-
%>
-
Now all I have to do is get the second page to execute then return to the first page rather than a blank page, then figure out why another bit of code isn't e-mailing
jhardman 3,406
Recognized Expert Specialist
I'm glad you got it working. Are you saying you are still looking at how to redirect? The code for redirecting is - response.redirect "firstPage.asp"
The only problem with this is that this won't send any data to firstPage.asp. You can solve this (if you need data sent) by putting the data in session variables - for each x in request.form
-
session(x) = request.form(x)
-
next
or in querystring - dim nextPage
-
nextPage = "firstPage.asp?"
-
for each x in request.form
-
nextPage = nextPage & x & "=" & server.urlEncode(request.form(x)) & "&"
-
next
-
nextPage = left(nextPage, len(nextPage)-1)
-
response.redirect nextPage
Let me know if this helps.
Jared
Thanks but I cheated, I put up a message on the second page confirming the e-mail message had been saved then put a button on it to direct the user back to the first page.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jim S. |
last post by:
I'm having a horrible time simply inserting the date in a MySQL
database through a Visual Basic program. I have a table, called
"ORDERS"; "ID" is the primary key. I'm trying the insert the date,
into the MySQL database, which is a DATETIME datatype. I must keep it
DATETIME so it can be accessed via Microsoft Access.
Here are two versions of the program. The first one fails, with the
"Row cannot be located for updating. Some values may...
|
by: Test Person |
last post by:
Hi
I'm having trouble with updating my database which is SqlServer. I'm using
the update command
and only the dataset is being changed not the actual row in the database.
Best Regards
|
by: Neoharuo |
last post by:
I am working on a VB2003 project that accesses a SQL Server database. The
first two forms (frmA, frmB) are almost identicle as far as the processes and
data access and updating. I've set it up so that they both use shared
functions to access and update the data but two their respective tables.
Neither form is open at the same time. I set up just one SqlDataAdapter that
has a mulit-table select that pulls in the entire database and uses just...
|
by: Bucko |
last post by:
How important do you guys feel locking a database is while
updating/adding information? Do you do it with every app you make? Only
very high volume (traffic) apps? I'm trying to decide if my app needs it.
|
by: Luis Esteban Valencia |
last post by:
Hello Everyone,
Iam an intermediate ASP.Net programmer and iam facing a challenging task.
I have a table in MS-SQL server database called 'Members'. The table has
following fields...
mem_id integer primary key
lastname nvarchar(30)
firstname nvarchar(30)
| |
by: Greg |
last post by:
I'm using the Framework 1.1, so I don't have access to the new
DataGridView object.
What I'm wondering is, is there a really simple way to bind a plain
datagrid to a database in such a way that changes made to cells in the
datagrid call an update on the corresoonding data within a database?
I've looked in vain for a really simple way to do this with minimal
coding, but I'm coming to the conclusion that I will have to trap the
events of...
|
by: Nick 'The Database Guy' |
last post by:
Hi Everyone,
Does anyone out there have a crack for the security on a Access 2000
and or Access 2002-2003 (they could even be the same) database.
I already have a crack for the database password on a Access 97
database, but it does not work on my later databases, and I'm not sure
how this works with Access 97 workgroup security.
Thank in advance.
|
by: mathews9138 |
last post by:
BadCopy Pro v3.81 crack
Free download Crack. You Find all crack!
Free download Crack. You Find all crack!
Free download Crack. You Find all crack!
Free download Crack. You Find all crack!
http://wga-cracks.crackkey.net
|
by: mathews9138 |
last post by:
Game House crack
Free download Crack. You Find all crack!
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |