HI
我正在練習用 sql parameter 去組裝查詢條件
前一個程式有成功,條件頗複雜,但這個看似簡單的小程式一直沒有成功
想破頭找遍資料還是不行
還請高手幫忙解惑 .. @ @
部份程式碼如下:
strSql = @"
SELECT
CAST(LIFNR AS INT) as 供應商編號,
NAME1 as 名稱,
ORT01 as 城市,
PSTLZ as 郵遞區號,
STRAS as 地址,
TELF1 as 聯絡人,
TELFX as 電話,
ADR6.SMTP_ADDR as eMail
from prd.LFA1
left join prd.ADR6 on LFA1.ADRNR = ADR6.ADDRNUMBER ";
if (!string.IsNullOrEmpty(txtVendor.Text))
{
//cmd.CommandText = strSql + "WHERE NAME1 LIKE N'%"+
txtVendor.Text.Trim() + "%'"; // 這樣寫可以
cmd.CommandText = strSql + "WHERE NAME1 LIKE '[email protected]/*