Click here to Skip to main content
15,914,500 members
Home / Discussions / C#
   

C#

 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
BobJanova10-Aug-11 3:58
BobJanova10-Aug-11 3:58 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
GenJerDan10-Aug-11 4:01
GenJerDan10-Aug-11 4:01 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
MicroVirus10-Aug-11 4:05
MicroVirus10-Aug-11 4:05 
AnswerRe: Filtering Problem in Sql Syntax using C#.net Pin
BobJanova10-Aug-11 3:57
BobJanova10-Aug-11 3:57 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
nassimnastaran10-Aug-11 4:23
nassimnastaran10-Aug-11 4:23 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
BobJanova10-Aug-11 8:25
BobJanova10-Aug-11 8:25 
AnswerRe: Filtering Problem in Sql Syntax using C#.net Pin
Ian Shlasko10-Aug-11 4:01
Ian Shlasko10-Aug-11 4:01 
AnswerRe: Filtering Problem in Sql Syntax using C#.net Pin
loyal ginger10-Aug-11 4:13
loyal ginger10-Aug-11 4:13 
The AccountNo field has a type of double in your database, which cannot be used with the 'like' operator. There are some solutions to this problem.

1. Change the type of AccountNo to text.

-or-

2. If you really want to use double for AccountNo, convert it to text in the query so that you can use the 'like' operator. The function to do the conversion may be different from one database engine to another. For example, in MySql, the function is 'cast', so something like this can be used:

string strFilterAccount = "cast(Accountno as char) like '" + Convert.ToDouble(txtAccount.Text) + "%'";


Considering that in many occasions an account number can really have letters and other non-digit characters in it, I think solution 1 may be better for you. (My water bill account number has letters and dashes embedded in it, for example)

SQL injection is a real issue here.
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
nassimnastaran10-Aug-11 4:41
nassimnastaran10-Aug-11 4:41 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
loyal ginger10-Aug-11 4:51
loyal ginger10-Aug-11 4:51 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
nassimnastaran10-Aug-11 5:38
nassimnastaran10-Aug-11 5:38 
GeneralRe: Filtering Problem in Sql Syntax using C#.net Pin
loyal ginger10-Aug-11 6:17
loyal ginger10-Aug-11 6:17 
Questionhow to transfer file from computer to terminal (windows-mobile) Through FTP Pin
goldsoft9-Aug-11 23:12
goldsoft9-Aug-11 23:12 
AnswerRe: how to transfer file from computer to terminal (windows-mobile) Through FTP Pin
Pravin Patil, Mumbai10-Aug-11 3:11
Pravin Patil, Mumbai10-Aug-11 3:11 
QuestionPayment gateway Integration into my website Pin
srikanthpoolla9-Aug-11 22:04
srikanthpoolla9-Aug-11 22:04 
AnswerRe: Payment gateway Integration into my website Pin
Richard MacCutchan9-Aug-11 23:24
mveRichard MacCutchan9-Aug-11 23:24 
AnswerRe: Payment gateway Integration into my website Pin
Pravin Patil, Mumbai10-Aug-11 0:47
Pravin Patil, Mumbai10-Aug-11 0:47 
Questionfile in use error Pin
goldsoft9-Aug-11 21:18
goldsoft9-Aug-11 21:18 
AnswerRe: file in use error Pin
OriginalGriff9-Aug-11 21:30
mveOriginalGriff9-Aug-11 21:30 
AnswerRe: file in use error Pin
Thomas R. Wolfe10-Aug-11 2:20
Thomas R. Wolfe10-Aug-11 2:20 
GeneralRe: file in use error Pin
OriginalGriff10-Aug-11 2:22
mveOriginalGriff10-Aug-11 2:22 
JokeRe: file in use error Pin
MicroVirus10-Aug-11 3:16
MicroVirus10-Aug-11 3:16 
GeneralRe: file in use error Pin
OriginalGriff10-Aug-11 3:34
mveOriginalGriff10-Aug-11 3:34 
QuestionSingle instance of a C# libraray across different processes Pin
Member 44129169-Aug-11 20:53
Member 44129169-Aug-11 20:53 
AnswerRe: Single instance of a C# libraray across different processes Pin
Shameel9-Aug-11 22:06
professionalShameel9-Aug-11 22:06 

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.