-
Can't sort on Field Contact...getting ambiguous error
Hello,
I have a two table database that is giving me a headache. The two tables are
Jobs & Contacts
In each table there is a Contact field so I use a Join statement:
SELECT Distinct Jobs.* FROM Jobs, Contacts WHERE Jobs.Contact = Contacts.Contact
When I go to do a sort on the column by clicking on the column heading, I get this error...
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Ambiguous column name 'Contact'.
/employment/clientview.asp, line 78
Any help is greatly appreciated... here is my code as well....
---------------------------------------------------------------------------
<%
Set MyDb = Server.CreateObject("AspDB.EP"
MyDb.dbDSN = "DSN=JobsDB; UID=sqluser; PWD=;"
MyDb.DbUnit=100
MyDb.DBColor="2,auto,steelblue"
MyDb.dbFilterFlds = "Facility,Department,Job_Title,Job_Type,Closin g_Date,Shift,Hours/PP"
MyDb.DbFilterDropFlds = "Facility,,Jobs,Facility,,,,,Distinct;Job_Type ,,Jobs,Job_Type,,,,,Distinct;Contact,,Jobs,Contact ,,,,,Distinct;Shift,,Jobs,Shift,,,,,Distinct;Posti ng_Date,,Jobs,Posting_Date,,,,,Distinct;Department ,,Jobs,Department,,,,,Distinct;Job_Title,,Jobs,[Job_Title],,,,,Distinct;Hours/PP,,Jobs,[Hours/PP],,,,,Distinct;Closing_Date,,Jobs,Closing_Date,,,,, Distinct"
MyDb.dbFilterParams = "Help=False, Assistant=True"
MyDb.dbFilterHideFlds = "Contact,Job_ID,Job_Code"
MyDb.dbFormHideFlds = "Job_ID,Job_Code"
MyDb.dbGridHideFlds = "Job_Type, Shift, Requirements, Job_ID,Posting_Date,Job_Code"
MyDb.DbGridTableTag="border=0 cellspacing=3 cellpadding=4"
MyDb.DbGridIndex = false
MyDb.DbGridInc = "10"
MyDb.dbImageDir="images/"
MyDb.dbMagicCell="Contact,,<A href=resume.asp?Contact=#(Contact)#>#Contact#,Job_ ID=#(Job_ID)#>#Job_ID#</a>;Facility,,#Facility#,index,, "
MyDb.DbMode="both"
MyDb.DbNavigation="top"
MyDb.DbNavigationItem = "top,prev,next,bottom,gridrow,filter,color,rel oad"
MyDb.DbNavigationIcon = "gif, grid, form, top, prev, next, bottom, rowplus, rowminus, gridplus, gridminus, formplus,formminus, search, resetfilter, download, color, reload, tables, edit, add, update, delete, save, open, updatebatch"
MyDb.DbStartup = "Filter"
Mydb.dbSQL = "SELECT Distinct Jobs.* FROM Jobs, Contacts WHERE Jobs.Contact = Contacts.Contact"
MyDb.DBStatusBar = true
s = DefaultDelimiters & zHead & ",<Center><h3>Add My record</h3></Center>; "
s = s & zDelHead & ",<CENTER><h3>Delete This record</h3></CENTER>; "
s = s & zAddhead & ",<h3>Master Edit Screen</h3>; "
s = s & zFilter & ",Query String = ; "
s = s & zFilterHead & ",<CENTER><strong><Font size=3 face=arial color=red>Directions:</strong></font><br><Font size=2 face=arial>If you wish to search by keyword without the drop down boxes simply click the <strong>Drop</strong> button.</font></CENTER><font size=2 face=arial>The more fields you choose to search by the narrower your results will be.<br>For more results search by the Facility Field only.</font>; "
s = s & zApplyFilter & ",Go do my Search; "
s = s & zResetFilter & ",Reset this filter screen; "
s = s & zHead & ",<CENTER><strong><font size='3' face='arial'>Current Jobs -</font></strong><font size='2' arial='face'> Click on the <strong><font face='arial' size='2' color='red'>Facility Field</font></strong> for more detail on a job. Click on the <strong><font face='arial' size='2' color='red'>Contact field</font></strong> to apply online.</font></CENTER><br>; "
s = s & zEdit & ",<FONT SIZE=5>EDIT<BR>NOW!</FONT>; "
s = s & zUpdate & ",<I>Update<BR>This Record<I>;"
s = s & zClear & ",Start Over;"
s = s & zDelete & ",Go Delete; "
s = s & zReturn & ",Return!; " ' was Return w/o Change;
s = s & zUpdateHead & ",Update This Record; "
s = s & zCopyRec & ",Make a Copy; "
s = s & zUpdateRec & ",UPDATE-REC!; "
s = s & zDrop & ",Toggle DropDown; "
s = s & zReset & ",Reset Fields!; " ' reset button on the Edit screen
s = s & zMemoText & ",Memo;"
s = s & zField & ",The Name of the Fields:;"
s = s & zNewRec & ",NEW RECORD!;"
s = s & zCurrentRec & ",This is the Current Record Now ...;"
s = s & zNotes & ",Notes in this area;"
s = s & zMsgFilterPassThruHelp & ",<B><center></Center></B>;"
MyDb.dbUserLocalText = s
MyDb.aspDBEP
%>
-
ambiguous, join, sort, dbNameMap
Jeremy,
I think you need to add a dbNameMap to allow sorting on joined columns.
See Programming Example 18 on the Enterprise site at:
http://www.aspdb.com/V2
You will need something like this:
Mydb.dbNameMap = "FldName,FldName,,Table1.FldName;"
Mark.
------------
Jeremy Kinser at 2/28/00 12:09:37 PM
Hello,
I have a two table database that is giving me a headache. The two tables are
Jobs & Contacts
In each table there is a Contact field so I use a Join statement:
SELECT Distinct Jobs.* FROM Jobs, Contacts WHERE Jobs.Contact = Contacts.Contact
When I go to do a sort on the column by clicking on the column heading, I get this error...
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Ambiguous column name 'Contact'.
/employment/clientview.asp, line 78
Any help is greatly appreciated... here is my code as well....
---------------------------------------------------------------------------
<%
Set MyDb = Server.CreateObject("AspDB.EP"
MyDb.dbDSN = "DSN=JobsDB; UID=sqluser; PWD=;"
MyDb.DbUnit=100
MyDb.DBColor="2,auto,steelblue"
MyDb.dbFilterFlds = "Facility,Department,Job_Title,Job_Type,Closin g_Date,Shift,Hours/PP"
MyDb.DbFilterDropFlds = "Facility,,Jobs,Facility,,,,,Distinct;Job_Type ,,Jobs,Job_Type,,,,,Distinct;Contact,,Jobs,Contact ,,,,,Distinct;Shift,,Jobs,Shift,,,,,Distinct;Posti ng_Date,,Jobs,Posting_Date,,,,,Distinct;Department ,,Jobs,Department,,,,,Distinct;Job_Title,,Jobs,[Job_Title],,,,,Distinct;Hours/PP,,Jobs,[Hours/PP],,,,,Distinct;Closing_Date,,Jobs,Closing_Date,,,,, Distinct"
MyDb.dbFilterParams = "Help=False, Assistant=True"
MyDb.dbFilterHideFlds = "Contact,Job_ID,Job_Code"
MyDb.dbFormHideFlds = "Job_ID,Job_Code"
MyDb.dbGridHideFlds = "Job_Type, Shift, Requirements, Job_ID,Posting_Date,Job_Code"
MyDb.DbGridTableTag="border=0 cellspacing=3 cellpadding=4"
MyDb.DbGridIndex = false
MyDb.DbGridInc = "10"
MyDb.dbImageDir="images/"
MyDb.dbMagicCell="Contact,,<A href=resume.asp?Contact=#(Contact)#>#Contact#,Job_ ID=#(Job_ID)#>#Job_ID#</a>;Facility,,#Facility#,index,, "
MyDb.DbMode="both"
MyDb.DbNavigation="top"
MyDb.DbNavigationItem = "top,prev,next,bottom,gridrow,filter,color,rel oad"
MyDb.DbNavigationIcon = "gif, grid, form, top, prev, next, bottom, rowplus, rowminus, gridplus, gridminus, formplus,formminus, search, resetfilter, download, color, reload, tables, edit, add, update, delete, save, open, updatebatch"
MyDb.DbStartup = "Filter"
Mydb.dbSQL = "SELECT Distinct Jobs.* FROM Jobs, Contacts WHERE Jobs.Contact = Contacts.Contact"
MyDb.DBStatusBar = true
s = DefaultDelimiters & zHead & ",<Center><h3>Add My record</h3></Center>; "
s = s & zDelHead & ",<CENTER><h3>Delete This record</h3></CENTER>; "
s = s & zAddhead & ",<h3>Master Edit Screen</h3>; "
s = s & zFilter & ",Query String = ; "
s = s & zFilterHead & ",<CENTER><strong><Font size=3 face=arial color=red>Directions:</strong></font><br><Font size=2 face=arial>If you wish to search by keyword without the drop down boxes simply click the <strong>Drop</strong> button.</font></CENTER><font size=2 face=arial>The more fields you choose to search by the narrower your results will be.<br>For more results search by the Facility Field only.</font>; "
s = s & zApplyFilter & ",Go do my Search; "
s = s & zResetFilter & ",Reset this filter screen; "
s = s & zHead & ",<CENTER><strong><font size='3' face='arial'>Current Jobs -</font></strong><font size='2' arial='face'> Click on the <strong><font face='arial' size='2' color='red'>Facility Field</font></strong> for more detail on a job. Click on the <strong><font face='arial' size='2' color='red'>Contact field</font></strong> to apply online.</font></CENTER><br>; "
s = s & zEdit & ",<FONT SIZE=5>EDIT<BR>NOW!</FONT>; "
s = s & zUpdate & ",<I>Update<BR>This Record<I>;"
s = s & zClear & ",Start Over;"
s = s & zDelete & ",Go Delete; "
s = s & zReturn & ",Return!; " ' was Return w/o Change;
s = s & zUpdateHead & ",Update This Record; "
s = s & zCopyRec & ",Make a Copy; "
s = s & zUpdateRec & ",UPDATE-REC!; "
s = s & zDrop & ",Toggle DropDown; "
s = s & zReset & ",Reset Fields!; " ' reset button on the Edit screen
s = s & zMemoText & ",Memo;"
s = s & zField & ",The Name of the Fields:;"
s = s & zNewRec & ",NEW RECORD!;"
s = s & zCurrentRec & ",This is the Current Record Now ...;"
s = s & zNotes & ",Notes in this area;"
s = s & zMsgFilterPassThruHelp & ",<B><center></Center></B>;"
MyDb.dbUserLocalText = s
MyDb.aspDBEP
%>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|