now my code is giving an error as statement expected in the line 
below
    set conn=Server.CreateObject("ADODB.Connection")


whole code

<%@ Language=VBscript %>
<% option explicit %>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">
<title>All the values with an asterisk</title>
<meta name="Microsoft Theme" content="compass 1011">
</head>

<body>
<%
dim serialnumber
dim modelnumber
dim description
dim errorMsg
dim i
dim conn
dim SQL
dim R
dim RecsAffected
dim aConnectionString
if Request.ServerVariables("REQUEST_METHOD")="POST" THEN
serialnumber = Request.Form("serialnumber")
modelnumber = Request.Form("modelnumber")
description = Request.Form("description")
serialnumber = trim(serialnumber)
modelnumber = trim(modelnumber)
description = trim(description)

if len(serialnumber)=0  then
   errorMsg = "You must enter the serial number"
   else 
   for i=1 to len(serialnumber)
   if instr(1,"abcdefghijklmnopqrstuvwxyz-*" ,mid
(serialnumber,i,1),vbTextcompare)=0 then
   errorMsg="serial number is not valid"
   exit for
   end if 
   next
   end if
if len(errorMsg)=0  then
if len(modelnumber)=0  then
   errorMsg = "You must enter the model number"
   else 
   for i=1 to len(modelnumber)
   if instr(1,"abcdefghijklmnopqrstuvwxyz-*'", mid
(modelnumber,i,1),vbTextcompare)=0 then
   errorMsg="model number is not valid"
   exit for
   end if 
   next
   end if
   end if
if len(errorMsg)=0  then

Response.Write "Serial Number=" & serialnumber 
Response.Write "Model Number=" & modelnumber 
Response.Write "Description=" & description 
end if
if len(errorMsg)= 0 then
aConnectionString= "Provider=SQLOLEDB;Data"
    & "Source=(local);Database=ClassRecords;"
    & UID=sa;PWD=;"
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Mode=adModeReadWrite
    conn.ConnectionString=adUseClient
    conn.open

conn.BeginTrans

SQL="INSERT INTO inventory (serialnumber,modelnumber,description) 
values("& serialnumber & ", " & modelnumber & ", '" & description 
& "')" 
conn.Execute SQL,,adCmdText + adExecuteNoRecords
if conn.Error.Count = 0 Then
   conn.CommitTran
Else
   conn.RollbackTrans
end if   
conn.close
set conn=Nothing
end if

end if
%>

<p><i>All the fields with asterisk(<font color="#FF0000">*</font>) 
sign are 
<font color="#FF0000">mandatory</font></i></p>
<p></p>
<form name= "frmuserInfo" action= "inventory.asp" method= "post">
<%if len(errorMsg)>0 then
Response.Write "<p><font color = red> "& errorMsg & "</font></p>" 
end if
%>
&nbsp;&nbsp; 
<table border="0" cellpadding="0" cellspacing="0" width="40%">
<tr>
<td width="30%"><b>Serial number</b></td>
<td colspan="2"><b><input type="text" name="Serialnumber" value="<% 
=serialnumber %>"></b></td>

</tr>
<tr>
<td ><b>Model number</b></td>
<td colspan="2"><b><input type="text" name="modelnumber" value="<% 
=modelnumber %>"></b></td>

</tr>

<tr>
<td><b>Description</b></td>
<td colspan="2">
<select >
<option selected value="none">none</option>
<option value="keyboard">Keyboard</option>
<option value="scanner">scanner</option>
<option value="fingerprintreader">finger print reader</option>
</select><p>
</tr>
<tr>
<td align=center> &nbsp;</td>
<td align=center width=110><input name="Submit" type=submit 
value="Submit"></td>
<td align=center width=100><input name="Reset" type=reset 
value="Reset"></td>
</tr>





</table>
</form>
</body>

</html>








------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to