DBアプリテストのページ 登録完了のソース


<%@ Language=VBScript %>
<% ' VI 6.0スクリプティング オブジェクト モデル使用可能 %>
<!--#include file="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=x-sjis">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<LINK REL="stylesheet" TYPE="text/css" HREF="_Themes/sumipntg/THEME.CSS" VI6.0THEME="墨絵">
<LINK REL="stylesheet" TYPE="text/css" HREF="_Themes/sumipntg/GRAPH0.CSS" VI6.0THEME="墨絵">
<LINK REL="stylesheet" TYPE="text/css" HREF="_Themes/sumipntg/COLOR0.CSS" VI6.0THEME="墨絵">
<LINK REL="stylesheet" TYPE="text/css" HREF="_Themes/sumipntg/CUSTOM.CSS" VI6.0THEME="墨絵"></HEAD>
<BODY>

<P>&nbsp;</P>

<%
in_id=Request.Form("text1")
in_pass1=Request.Form("password1")
in_pass2=Request.Form("password2")
in_name=Request.Form("text2")
in_sei=Request.Form("radio1")
in_work=Request.Form("select1")

if in_sei="on" then
in_sei="1" 'Yes=男
else
in_sei="0" 'No=女
end if
%>
<!--
<%=in_sei%>
<%=in_work%>
-->
<%
inp_sw=0
inp_msg=""
'-----データ未入力の確認
if in_id="" then
inp_msg=inp_msg & "IDが未入力です <BR>"
inp_sw=1
end if
if in_pass1="" then
inp_msg=inp_msg & "パスワードが未入力です <BR>"
inp_sw=1
end if
if in_pass2="" then
inp_msg=inp_msg & "パスワード確認が未入力です <BR>"
inp_sw=1
end if
if in_name="" then
inp_msg=inp_msg & "氏名が未入力です <BR>"
inp_sw=1
end if
%>

<%
'--------データ未入力メッセージの表示
if inp_sw=1 then
inp_msg=inp_msg & "<P>" & "戻るボタンで登録に戻って、"
inp_msg=inp_msg & "再度処理してください <BR>"
%>
<%=inp_msg%>
<%
else
set rec_1 = server.CreateObject("ADODB.connection")
rec_1.Open "DSN=test3_db"
set rec1_com = server.CreateObject("ADODB.command")
rec1_com.CommandText="INSERT INTO user1(ID,pass,氏名,性別,職業) " & _
"VALUES('" & in_id & "','" & in_pass1 & "','" & in_name & "','" & _
in_sei & "','" & in_work & "')"
set rec1_com.ActiveConnection = rec_1
rec1_com.Execute
%>

<!-- 登録終了のメッセージ-->
<P align=center>
<% =in_name %> 様 、ユーザーとして登録させていただきました。<br>
ご利用をお待ちしております。<br>
<br>
<A href="http://sim2/test3/db index.htm"><FONT color=blue face=Arial size=2>
登録のページへ</FONT></A><BR>
</P>

<%
end if
%>

</BODY>
<% ' VI 6.0スクリプティング オブジェクト モデル使用可能 %>
<% EndPageProcessing() %>
</FORM>
</HTML>
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT classid="clsid:9CF5D7C2-EC10-11D0-9862-0000F8027CA0" id=Recordset1 style="LEFT: 0px; TOP: 0px">
<PARAM NAME="ExtentX" VALUE="15875">
<PARAM NAME="ExtentY" VALUE="2090">
<PARAM NAME="State" VALUE="(TCConn=\qConnection1\q,TCDBObject=\qTables\q,TCDBObjectName=\quser1\q,TCControlID_Unmatched=\qRecordset1\q,TCPPConn=\qConnection1\q,RCDBObject=\qRCDBObject\q,TCPPDBObject=\qTables\q,TCPPDBObjectName=\quser1\q,TCCursorType=\q3\s-\sStatic\q,TCCursorLocation=\q3\s-\sUse\sclient-side\scursors\q,TCLockType=\q3\s-\sOptimistic\q,TCCacheSize_Unmatched=\q10\q,TCCommTimeout_Unmatched=\q10\q,CCPrepared=0,CCAllRecords=1,TCNRecords_Unmatched=\q10\q,TCODBCSyntax_Unmatched=\q\q,TCHTargetPlatform=\q\q,TCHTargetBrowser_Unmatched=\qServer\s(ASP)\q,TCTargetPlatform=\qInherit\sfrom\spage\q,RCCache=\qRCBookPage\q,CCOpen=1,GCParameters=(Rows=0))"></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
<SCRIPT LANGUAGE="JavaScript" RUNAT="server">
function _initRecordset1()
{
var DBConn = Server.CreateObject('ADODB.Connection');
DBConn.ConnectionTimeout = Application('Connection1_ConnectionTimeout');
DBConn.CommandTimeout = Application('Connection1_CommandTimeout');
DBConn.CursorLocation = Application('Connection1_CursorLocation');
DBConn.Open(Application('Connection1_ConnectionString'), Application('Connection1_RuntimeUserName'), Application('Connection1_RuntimePassword'));
var cmdTmp = Server.CreateObject('ADODB.Command');
var rsTmp = Server.CreateObject('ADODB.Recordset');
cmdTmp.ActiveConnection = DBConn;
rsTmp.Source = cmdTmp;
cmdTmp.CommandType = 2;
cmdTmp.CommandTimeout = 10;
cmdTmp.CommandText = '`user1`';
rsTmp.CacheSize = 10;
rsTmp.CursorType = 3;
rsTmp.CursorLocation = 3;
rsTmp.LockType = 3;
Recordset1.setRecordSource(rsTmp);
Recordset1.open();
if (thisPage.getState('pb_Recordset1') != null)
Recordset1.setBookmark(thisPage.getState('pb_Recordset1'));
}
function _Recordset1_ctor()
{
CreateRecordset('Recordset1', _initRecordset1, null);
}
function _Recordset1_dtor()
{
Recordset1._preserveState();
thisPage.setState('pb_Recordset1', Recordset1.getBookmark());
}
</SCRIPT>

<!--METADATA TYPE="DesignerControl" endspan-->



Monjyo ホームページにもどる   ASPでつくるインターネットWeb本屋さんのページにもどる