Search keywords

gg
展开阅读全文

search

05-28

我想從數據庫中同時查找符合幾個條件的記錄,而且黨有一個條件沒有填的時候就查找符合除了這個條件之外的條件。即要實現綜合查詢,代碼如下所示:rn rn rn Customer Name : rn ">rn Please selectrn <%rnWhile (NOT customer.EOF)rn%>rn "><%=(customer.Fields.Item("Account").Value)%>rn <%rn customer.MoveNext()rnWendrnIf (customer.CursorType > 0) Thenrn customer.MoveFirstrnElsern customer.RequeryrnEnd Ifrn%>rn rn rn rn rn rn rn rn Supplier Name:rn rn Please selectrn <%rnWhile (NOT supplier.EOF)rn%>rn<%if (supplier.Fields.Item("supplier").Value)<>"" then%>rn "><%=(supplier.Fields.Item("supplier").Value)%><%end if%>rn <%rn supplier.MoveNext()rnWendrnIf (supplier.CursorType > 0) Thenrn supplier.MoveFirstrnElsern supplier.RequeryrnEnd Ifrn%>rn rn rn rn rn rn rn Part Number:rn rn rn rn rn rn rn PO input date:rn rn rn rn rn rn rn Waiting:rn rn rn rn Yesrn rn rn Norn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn 結果頁面的查詢語句:rn<%rnDim Recordset1__MMColParamrnRecordset1__MMColParam = "%"rnIf (Session("customer") <> "") Then rn Recordset1__MMColParam = Session("customer") rnEnd Ifrn%>rn<%rnDim Recordset1__MMColParam1rnRecordset1__MMColParam1 = "%"rnIf (Session("supplier") <> "") Then rn Recordset1__MMColParam1 = Session("supplier")rnEnd Ifrn%>rn<%rnDim Recordset1__MMColParam2rnRecordset1__MMColParam2 = "%"rnIf (Session("part") <> "") Then rn Recordset1__MMColParam2 = Session("part")rnEnd Ifrn%>rn<%rnDim Recordset1__MMColParam4rnRecordset1__MMColParam4 = "2"rnIf (Session("waiting") <> "") Then rn Recordset1__MMColParam4 = Session("waiting") rnEnd Ifrn%>rn<%rnDim Recordset1__MMColParam3rnRecordset1__MMColParam3 = "1900/01/02"rnIf (Session("podate") <> "") Then rn Recordset1__MMColParam3 = Session("podate") rnEnd Ifrn%>rnrnSELECT *rnFROM dbo.txtdatarnWHERE (customer = 'MMColParam' and supplier='MMColParam1' and Orderinputdate='MMColParam3' and partNo='MMColParam2' and response='MMColParam4')rnrn可是不知道為什麼找不到記錄,黨and把改成or後可以找到一部分記錄,但是,不是符合條件的。 论坛

没有更多推荐了,返回首页