Click here to Skip to main content
15,891,184 members
Home / Discussions / Database
   

Database

 
GeneralRe: Creating a User Defined Type For Time Pin
AAGTHosting21-Jan-08 20:35
AAGTHosting21-Jan-08 20:35 
GeneralAccess/Jet SQL (Uggh!!) Code Commenting Pin
martin_hughes21-Jan-08 10:52
martin_hughes21-Jan-08 10:52 
GeneralMysql strong typed dataset relations error. Pin
Y_R21-Jan-08 4:28
Y_R21-Jan-08 4:28 
Generalselect count values in sql Pin
eyeseetee21-Jan-08 4:01
eyeseetee21-Jan-08 4:01 
GeneralRe: select count values in sql Pin
Pete O'Hanlon21-Jan-08 4:52
mvePete O'Hanlon21-Jan-08 4:52 
Questionhow to use the keyword LIKE in the SQL query in C# statement Pin
mavii21-Jan-08 2:29
mavii21-Jan-08 2:29 
AnswerRe: how to use the keyword LIKE in the SQL query in C# statement Pin
Pete O'Hanlon21-Jan-08 4:56
mvePete O'Hanlon21-Jan-08 4:56 
AnswerRe: how to use the keyword LIKE in the SQL query in C# statement [modified] Pin
Michael Potter22-Jan-08 5:20
Michael Potter22-Jan-08 5:20 
Pete is correct in saying that this is dangerous code. You have to use strong
protection to make sure that crimewithdate.text2 does not contain
any malicious SQL code instead of the expected search parameter.

To answer your question as asked, here is one solution:
string q = string.Format("SELECT collapsed_building.b_name,
collapsed_building.b_desc FROM collapsed_building 
WHERE collapsed_building.b_name LIKE '%{0}%'", crimewithdate.text2);

(The line breaks are for readability only)

Do realize that an evil user could enter something like;
x'; TRUNCATE TABLE collapsed_building; SELECT * FROM collapsed_building WHERE b_name LIKE 'x
and wreck your whole day.

It is much better to pass crimewithdate.text2 as a parameter and not expose your database to bad people.

modified on Tuesday, January 22, 2008 11:26:49 AM

GeneralUnable to see SQL Server Agent in Object Explorer of sqlserver 2005 Pin
Satish - Developer21-Jan-08 2:24
Satish - Developer21-Jan-08 2:24 
QuestionHow can we access a Table from a Database to the another DataBase Pin
John.L.Ponratnam21-Jan-08 1:15
John.L.Ponratnam21-Jan-08 1:15 
AnswerRe: How can we access a Table from a Database to the another DataBase Pin
pmarfleet21-Jan-08 2:02
pmarfleet21-Jan-08 2:02 
AnswerRe: How can we access a Table from a Database to the another DataBase Pin
PIEBALDconsult21-Jan-08 3:36
mvePIEBALDconsult21-Jan-08 3:36 
Generalnewbie in Crystal report Pin
wasimsharp21-Jan-08 1:13
wasimsharp21-Jan-08 1:13 
GeneralCross post - please ignore Pin
Pete O'Hanlon21-Jan-08 1:39
mvePete O'Hanlon21-Jan-08 1:39 
GeneralEncryption / Decryption Pin
Syed Mujtaba Hassan21-Jan-08 1:11
Syed Mujtaba Hassan21-Jan-08 1:11 
GeneralRe: Encryption / Decryption Pin
StianSandberg21-Jan-08 10:19
StianSandberg21-Jan-08 10:19 
QuestionHow to Schedule a Job in sqlserver 2005 Pin
Satish - Developer21-Jan-08 0:49
Satish - Developer21-Jan-08 0:49 
AnswerRe: How to Schedule a Job in sqlserver 2005 Pin
pmarfleet21-Jan-08 2:03
pmarfleet21-Jan-08 2:03 
GeneralRe: How to Schedule a Job in sqlserver 2005 Pin
Satish - Developer21-Jan-08 2:25
Satish - Developer21-Jan-08 2:25 
GeneralRe: How to Schedule a Job in sqlserver 2005 Pin
pmarfleet21-Jan-08 2:38
pmarfleet21-Jan-08 2:38 
Generalsending mails in sqll Pin
mrcsn20-Jan-08 22:26
mrcsn20-Jan-08 22:26 
AnswerRe: sending mails in sqll Pin
Vasudevan Deepak Kumar20-Jan-08 23:49
Vasudevan Deepak Kumar20-Jan-08 23:49 
GeneralRe: sending mails in sqll Pin
SVb.net21-Jan-08 21:47
SVb.net21-Jan-08 21:47 
GeneralStored Procedure not returning any rows -- Pls Ignore[modified] Pin
meeram39520-Jan-08 21:32
meeram39520-Jan-08 21:32 
GeneralRe: Stored Procedure not returning any rows Pin
meeram39520-Jan-08 21:40
meeram39520-Jan-08 21:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.