Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2003, 06:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Query runs in SQL Server but not in ASP

When I submit the following query directly in Enterprise Manager:

SELECT * FROM TimeWorked where (SignDate = '7/9/2003') AND (EmployeeID = 1)

...it returns results.

The same query submitted to a Sql Adapter object in ASP.NET returns:

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

There are no constraints on the table of ANY kind and all of the fields contain values (and there is only one record to begin with). Any clues why this would work in SQL EM and not in ASP.NET? TIA
 
Old July 10th, 2003, 12:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

HOw do u call it?! sent ur code if its possible?!

Always:),
Hovik Melkomian.
 
Old July 14th, 2003, 04:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default

Here's the code (referencing a SqlAdapter defined on the form using .NET Server objects):

sqlAdpTimeWorked.SelectCommand.CommandText = "SELECT UniqueID FROM TimeWorked where (SignDate = '" & Format$(Now, "Short Date") & "') AND (EmployeeID = " & Request.QueryString("UniqueID") & ")"

sqlAdpTimeWorked.Fill(DsTimeWorked)

This results in the SQL statement mentioned earlier.

If this provides additional clues for why it won't work when submitted from code, please elaborate, because I'd like to know what this code might be telling you that my previous question did not. TIA...





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server Crosstab Query elygp SQL Server 2000 2 May 5th, 2007 11:57 AM
ASP- SQL Server..Query help.... cancer10 Classic ASP Databases 5 February 1st, 2007 06:26 AM
SQL SERVER Query pavanpareta SQL Server ASP 2 December 18th, 2006 04:51 PM
ASP script runs when page closes cookster Classic ASP Professional 1 January 12th, 2006 10:46 PM
Query runs forever Mitch SQL Server 2000 15 October 28th, 2003 10:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.