Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 28th, 2004, 04:35 AM
mojito mojito is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 35 mojito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Microsoft OLE DB Provider for SQL Server error '80040e21'

When I try to insert a record into a table I get the following error.

Microsoft OLE DB Provider for SQL Servererror '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done

It's in SQL server.

Here's the asp code to insert the record.

Code:
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ Language=VBScript %>
<!-- #include file="adovbs.inc" -->
<html>
<head>
<title>Testcase</title>
<link rel="STYLESHEET" href="style.css" type="text/css">
</head>
<body>
<%
dim objConn
set objConn = server.CreateObject("ADODB.Connection")
objConn.open "PROVIDER=SQLOLEDB;DATA SOURCE=SYE-TESTSERV\SQL2000_SP;UID=***;PWD=***;DATABASE=Globa  l_Test_DB_DEV "
If((Request.Form("TC_Version")="")OR(Request.Form("Description")="")OR(Request.Form("Purpose")="")OR(Request.Form("Test_Time_Estimated")="")OR(Request.Form("Prep_Time_Estimated")="")OR(Request.Form("Repetition_Factor")=""))Then
Response.write "You must enter values for the fields with a *. Click on the Back button in your browser to return."
Else
dim objRS
set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open "TestCases", objConn, , adLockOptimistic, adCmdTable
objRS.AddNew
dim strSQL
strSQL="select TestID FROM TestID_Description WHERE CL1='" &Request.Form("CL1")& "' AND CL2='" &Request.Form("CL2")& "'AND CL3='" &Request.Form("CL3")& "'AND CL4='" &Request.Form("CL4")& "'AND CL5='" &Request.Form("CL5")& "'AND CL6='" &Request.Form("CL6")& "'"
objRS("TC_Number")=strSQL This line gives the error. And strSQL only has one result cause the TestID in the query is the primary key.
objRS("TC_Version")=Request.Form("TC_Version")
objRS("Description")=Request.Form("Description")
objRS("Purpose")=Request.Form("Purpose")
objRS("CL1")=Request.Form("CL1")
objRS("CL2")=Request.Form("CL2")
objRS("CL3")=Request.Form("CL3")
objRS("CL4")=Request.Form("CL4")
objRS("CL5")=Request.Form("CL5")
objRS("CL6")=Request.Form("CL6")
objRS("Priority")=Request.Form("Priority")
objRS("Extra_Test_Map")=Request.Form("Extra_Test_Map")
objRS("Test_Time_Estimated")=Request.Form("Test_Time_Estimated")
objRS("Prep_Time_Estimated")=Request.Form("Prep_Time_Estimated")
dim strCU
strCU=Request("Customer_Unit")
If strCU="1" then
	objRS("Customer_Unit")=Request.Form("Customer_Unit")
End If
objRS("Goat_Job_ID")=Request.Form("Goat_Job_ID")
objRS("Repetition_Factor")=Request.Form("Repetition_Factor")
objRS("Network")=Request.Form("Network")
dim strAUTO
strAUTO=Request("Automated")
If strAUTO="1" then
	objRS("Automated")=Request.Form("Automated")
End If
objRS("Pre_Condition")=Request.Form("Pre_Condition")
objRS("Scenario")=Request.Form("Scenario")
objRS("Post_Condition")=Request.Form("Post_Condition")
dim strRTD
strRTD=Request("Result_Type_Dynamic")
If strRTD="1" then
	objRS("Result_Type_Dynamic")=Request.Form("Result_Type_Dynamic")
End If
objRS("Result_Lower_Limit")=Request.Form("Result_Lower_Limit")
objRS("Result_Upper_Limit")=Request.Form("Result_Upper_Limit")
objRS("Result_Unit")=Request.Form("Result_Unit")
objRS("Comments")=Request.Form("Comments")
objRS("Extra_Necessarry_Material")=Request.Form("Extra_Necessarry_Material")
objRS("Extended_Reference")=Request.Form("Extended_Reference")
objRS("Date_Test_Added")=Request.Form("Date_Test_Added")
objRS("Use_Case")=Request.Form("Use_Case")
objRS("Specification_Reference")=Request.Form("Specification_Reference")
objRS("Added_By")=Request.Form("Added_By")
dim strApp
strApp=Request("Approved")
If strApp="1" then
	objRS("Approved")=Request.Form("Approved")
End If
dim strLD
strLD=Request("Language_Dependency")
If strLD="1" then
	objRS("Language_Dependency")=Request.Form("Language_Dependency")
End If
dim strPD
strPD=Request("Product_Dependency")
If strPD="1" then
	objRS("Product_Dependency")=Request.Form("Product_Dependency")
End If
dim strSWHD
strSWHD=Request("SW_history_Dependency")
If strSWHD="1" then
	objRS("SW_history_Dependency")=Request.Form("SW_history_Dependency")
End If
objRS.Update
objRS.Close
set objRS = Nothing
Response.Write("Testcase inserted in database.")
Response.Write("Please wait...")
Response.Write("You are being redirected to add your attachment.")
End If
objConn.Close
set objConn = Nothing
%>
<!--<script language="Javascript">history.back(0)</script>-->
</body>
</html>
 


Anyone who can help? I am very new to asp. I tried solving it with a trigger but it won't work cause the record can't be inserted without primary key.

Thanx in advance

Mojito

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Microsoft OLE DB Provider for SQL Server error '80040e21'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT