bool findtrue = false;
sqlconnection con = new sqlconnection("server=.;database=tongxunlu;integrated security=true");
gridview1.visible = false;
sqlcommand cmd = new sqlcommand("select * from newsmessages", con);
int i1 = findtxt.text.trim().length; //取當前用使用者輸入的字元的長度
con.open();
string sk = str.split(new char );
int sum = 0;
sqldatareader myreader;
myreader = cmd.executereader();
while (myreader.read())
table.rows.add(row);
}table.width = 900;
table.cellspacing = 0;
table.cellpadding = 10;
this.div1.controls.add(table);
findtrue = true;
break;}}
sum++; //取下乙個使用者設定的字段進行匹配
if (findtrue) 判斷是否已經找到了記錄
}else
break;}}
}
sql 模糊查詢
一般模糊語句如下 select 字段 from 表 where 某欄位 like 條件 其中關於條件,sql提供了四種匹配模式 1,表示任意0個或多個字元。可匹配任意型別和長度的字元,有些情況下若是中文,請使用兩個百分號 表示。比如 select from user where u name lik...
SQL模糊查詢
sql提供了四種匹配模式 1.表示任意 0個或多個字元。如下語句 select from user where name like 三 將會把 name為 張三 三腳貓 唐三藏 等等有 三 的全找出來 2.表示任意單個字元。語句 select from user where name like 三 ...
SQL模糊查詢
sql提供了四種模糊匹配方式 1,表示任意0個或多個字元。可匹配任意型別和長度的字元,有些情況下若是中文,請運用兩個百分號 表示。比如 select from user where u name like 三 將會把u name為 張三 張貓三 三腳貓 唐三藏 等等有 三 的記錄全找出來。另外,如果...