嘿傢伙即時通訊建立在asp.net即時搜索表單得到錯誤的存儲過程,代碼如下存儲過程的錯誤「曖昧列」
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[sp_searchcustomervendordetails]
@customervendortype varchar(30)=Null,
@customervendorid varchar(30)=Null,
@customervendorname varchar(30)=Null,
@state varchar(30)=Null,
@city varchar(30)=Null
AS
BEGIN
SET NOCOUNT ON;
--if @customervendortype is not null and len(@customervendortype)=0 set @customervendortype = null
--if @customervendorid is not null and len(@cuatomervendorid)=0 set @customervendorid = null
--if @customervendorname is not null and len(@customervendorname)=0 set @customervendorname = null
--if @city is not null and len(@city)=0 set @city = null
--if @state is not null and len(@state)=0 set @state = null
-- Insert statements for procedure here
SELECT CustomerVendorDetails.customervendorid AS CustomerVendorID,CustomerVendorAddressDetails.customervendorname, CustomerVendorAddressDetails.doorno, CustomerVendorAddressDetails.street,
CustomerVendorAddressDetails.city, CustomerVendorAddressDetails.state, CustomerVendorAddressDetails.country,
CustomerVendorAddressDetails.pincode, CustomerVendorDetails.decidingauthority,
CustomerVendorDetails.landlineno1, CustomerVendorDetails.landlineno2, CustomerVendorDetails.faxno, ContactPersonDetails.contactno,
ContactPersonDetails.designation
FROM CustomerVendorDetails INNER JOIN
CustomerVendorAddressDetails ON CustomerVendorDetails.customervendorid = CustomerVendorAddressDetails.customervendorid INNER JOIN
ContactPersonDetails ON CustomerVendorAddressDetails.customervendorid = ContactPersonDetails.customervendorid
WHERE (@customervendortype is null or customervendortype like @customervendortype)
or (@customervendorid is null or customervendorid like @customervendorid)
or (@customervendorname is null or customervendorname like @customervendorname)
or (city is null or city like @city)
or (state is null or state like @city)
END
即時得到這個錯誤
Msg 209, Level 16, State 1, Procedure sp_searchcustomervendordetails, Line 34
Ambiguous column name 'customervendorid'.
Msg 209, Level 16, State 1, Procedure sp_searchcustomervendordetails, Line 35
Ambiguous column name 'customervendorname'
給出
任何幫助我請
感謝朋友的工作 – Raj 2010-11-13 14:10:20