473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP insert query

114 100+
Dear Friends,

Please help me out where I am doing mistake...I am trying to insert records into my MSSQL database...but it always take me into the "page cannot be displayed"....Here is the code....


AddEOi.asp

---------------------------------------------------------------------------------------------------

[HTML]<%
if session("username")="" then
response.Redirect("login.asp")
end if

if request.QueryString("action")="done" then
vartext="EOI Added Successfully"
end if

if request.QueryString("action")="Exist" then
vartext="EOI Code Already Exists"
end if

%>
<html>
<head>
<title>New Login</title></title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>

<body leftMargin=0 topMargin=0><table width="100%" height="100%" cellpadding="1" bordercolor="#0000FF">
<tr>
<td valign="top"></td>
</tr>
<tr>
<td valign="top">

<table width="100%" align="center">
<tr>
<td bordercolor="#0000FF"><table width="100%" >
<tr bgcolor="#006699">
<td align="center"><div align="center"><strong><font color="#333333" size="4">Add EOI(Expression osf Interest)</font></strong></div></td>
</tr>
<tr>
<td align="center" class="mytextred"><%=vartext%></td>
</tr>
<tr>
<td>
<form name="frm" action="function_eoi.asp" method="post" >
<table width="86%" border="1" cellpadding="4" cellspacing="0" bordercolor="#006666" align="center">



<tr>
<td width="50%" align="right"> EOI Code :</td>
<td width="50%"><input type="text" name="code" id="code" ></td>
</tr>
<tr>
<td width="50%" align="right">Title :</td>
<td width="50%"><input type="text" name="title" id="title" ></td>
</tr>
<tr>
<td width="50%" align="right">Client :</td>
<td width="50%"><input type="text" name="client" id="client" ></td>
</tr>
<tr>
<td width="50%" align="right">Date of Submission :</td>
<td width="50%"><input type="text" name="datesub" id="datesub" ></td>
</tr>
<tr>
<td width="50%" align="right"> Status:</td>
<td width="50%"><select name="status">
<option value="Consideration">Consideration</option>
<option value="Shortlisted">Shortlisted</option>
<option value="Not Shortlisted">Not Shortlisted</option>

</select></td>
</tr>



<tr>
<td align="right"></td>
<td><input name="Submit" type="submit" id="Submit" value="Submit"> &nbsp; &nbsp;
<input type="reset" name="Reset">
</td>
</tr>

</table>
</form></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>

</td>
</tr>
</table>


</body>
</html>[/HTML]
----------------------------------------------------------------------------------------------------



function_eoi.asp

------------------------------------------------------------------------------------------------------
[HTML]<!-- #include file="include/connection.asp" -->
<%
if session("username")="" then
Response.Redirect("login.asp")
end if
code=Request("code")
title=Request("title")
client=Request("client")
datesub=Request("datesub")
status=Request("status")

rs1="select eoicode from eoi_test where eoicode='"& code &"'"
set rs1=Server.CreateObject("adodb.recordset")
rs1.Open rs1,con,1,3

if rs1.RecordCount>0 then
Response.Redirect "AddEOi.asp?action=Exist"
else

query="insert into eoi_test (eoicode,eoititle,client,datesubmit,status)values( '"& code &"','"& title &"', '"& client &"','"& datesub &"','"& status &"')"
rs1.Open query,con,1,3
Response.Redirect("AddEOi.asp?action=done")

end if

%>[/HTML]------------------------------------------------------------------------------------------------------




Please help me.......

Thanks
Deepak
Apr 17 '07 #1
1 4834
deepaks85
114 100+
I also want to give a command that if record is not getting insert it should show me an error msg.

How can I give that?

Thanks
Deepak
Apr 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: johnnyboy10017 | last post by:
I am having a hell of a time with what I think is a very simple query: It won't actually insert a new record into the specified table, but returns no error, in fact it returns "1" (or true) that...
8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
2
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. ...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
7
by: David Bear | last post by:
I have a dictionary that contains a row of data intended for a data base. The dictionary keys are the field names. The values are the values to be inserted. I am looking for a good pythonic...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
2
by: cbadchris | last post by:
I am writing an import function with asp, and excel that writes imported excel sheets to to several SQL tables and everything works fine until it reaches the "add data for search" section or query 2....
2
by: lenygold via DBMonster.com | last post by:
Hi Everebody: I have a table: CREATE TABLE CROSS_REFERENCE (ROW# INTEGER NOT NULL ,KEY_WORD CHAR(16) NOT NULL ,QUERY_DESCR VARCHAR(330) NOT NULL ,PRIMARY KEY (ROW#,KEY_WORD)); It is a...
8
by: Betikci Boris | last post by:
Can not insert data into SQLite3 database through browser however i can easily insert data into my db from konsole, in both attmpts i used php 5.2.6 on 2.6.25.* linux kernel i think there is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.