Eigentlich ganz einfach:
strName = Request.Form("name")
strComments = Request.Form("comments")
strEmain = Request.Form("email")
strUrl = Request.Form("url")
strIcq = Request.Form("icq")
If strName <> Empty AND strComments <> Empty Then
Dim adoCon
Dim rsAddComments
Dim strSQL
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("guestbook.mdb")
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.Name, tblComments.Comments,
tblComments.email, tblComments.url, tblComments.icq FROM tblComments;"
rsAddComments.CursorType = 2 rsAddComments.LockType = 3
rsAddComments.Open strSQL, adoCon
rsAddComments.AddNew
rsAddComments.Fields("Name") = Request.Form("name")
rsAddComments.Fields("Comments") = Request.Form("comments")
rsAddComments.Fields("email") = Request.Form("email")
rsAddComments.Fields("url") = Request.Form("url")
rsAddComments.Fields("icq") = Request.Form("icq")
rsAddComments.Update
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
End If
Response.Redirect "guestbook.asp"
-----Urspr�ngliche Nachricht-----
Von: Markus Schutz [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 13. M�rz 2002 20:23
An: ASP Diskussionsliste fuer Anfaenger
Betreff: [aspdebeginners] eingaben �berpr�fen
und gleich die n�chste frage hinterher. wer kann mir bei folgendem
helfen? -
>
ich hab folgendenen code und will, dass er bevor er den neuen datensatz
erstellt �berpr�ft, ob das feld "name" und "comment" ausgef�llt sind.
nur leider hab ich keine ahnung wie des geht also, kann mir jemand
schnell durch den code geheen und die �nderungen vornehmen oder mir
zumindest ein bissel hilfestellung geben? - soviel von mir
mfg
Markus
[code]:
<%
Dim adoCon
Dim rsAddComments
Dim strSQL
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("guestbook.mdb")
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.Name, tblComments.Comments,
tblComments.email, tblComments.url, tblComments.icq FROM tblComments;"
rsAddComments.CursorType = 2 rsAddComments.LockType = 3
rsAddComments.Open strSQL, adoCon
rsAddComments.AddNew
rsAddComments.Fields("Name") = Request.Form("name")
rsAddComments.Fields("Comments") = Request.Form("comments")
rsAddComments.Fields("email") = Request.Form("email")
rsAddComments.Fields("url") = Request.Form("url")
rsAddComments.Fields("icq") = Request.Form("icq")
rsAddComments.Update
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
Response.Redirect "guestbook.asp"
%>
[/code]
--
GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
| Oft Gefragtes: http://www.aspgerman.com/aspgerman/faq/
| [aspdebeginners] als [EMAIL PROTECTED] subscribed
| http://www.aspgerman.com/archiv/aspdebeginners/ = Listenarchiv Sie
| knnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdebeginners.asp
| Oft Gefragtes: http://www.aspgerman.com/aspgerman/faq/
| [aspdebeginners] als [email protected] subscribed
| http://www.aspgerman.com/archiv/aspdebeginners/ = Listenarchiv
| Sie knnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdebeginners.asp