Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


SQL-lite select using AND operator


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2008, 10:57 AM
Senior Member
 
Join Date: Mar 2008
Posts: 102
Default SQL-lite select using AND operator

I am trying to select rows from a database depending on 2 conditions. Tried to use AND but this did not work (see code below). Any suggestions?

cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = "&txthhidm.Text&" & AND & motherno = "&(txthhidm.Text&*100)+&txtmemno.Text&""

Regards
Reply With Quote
  #2 (permalink)  
Old 06-02-2008, 01:02 PM
giannimaione's Avatar
Senior Member
 
Join Date: Apr 2007
Location: Naples, Italy
Posts: 155
Send a message via Skype™ to giannimaione
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Mozaharul,

try it:

cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = " & txthhidm.Text & " AND motherno = " & ((txthhidm.Text*100) + txtmemno.Text)

or
YourQuery="select name,perm_id,permid_moth from motherno where hpid = " & txthhidm.Text & " AND motherno = " & ((txthhidm.Text*100) + txtmemno.Text)
msgbox(YourQuery):' only for testing
cmd.CommandText=YourQuery

are you sure that txthhidm and txtmemno are ONLY numeric value???
__________________
Gianni Maione
Reply With Quote
  #3 (permalink)  
Old 06-03-2008, 04:27 AM
Senior Member
 
Join Date: Mar 2008
Posts: 102
Default

Hi giannimaione,

Thanks for the help.

txthhidm and txtmemno are both numeric value.

I'm not clear about the last two quotes have been dropped from my code. Off course, the syntax generated error. Could you please explain ?


Best regards,

Mozaharul
Reply With Quote
  #4 (permalink)  
Old 06-03-2008, 10:05 AM
giannimaione's Avatar
Senior Member
 
Join Date: Apr 2007
Location: Naples, Italy
Posts: 155
Send a message via Skype™ to giannimaione
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi mozaharul

Quote:
Originally Posted by mozaharul View Post
cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = "&txthhidm.Text&" & AND & motherno = "&(txthhidm.Text&*100)+&txtmemno.Text&""
in your code there are two errors syntax
1) & AND &
2) &txtmemno.Text&""

Sorry, but i am not more explain , and i am sorry for my bad english
__________________
Gianni Maione
Reply With Quote
  #5 (permalink)  
Old 06-04-2008, 04:52 AM
Senior Member
 
Join Date: Mar 2008
Posts: 102
Default

Hi giannimaione,

Its OK, thanks for the explanation.


regards,
Reply With Quote
  #6 (permalink)  
Old 06-04-2008, 08:27 AM
giannimaione's Avatar
Senior Member
 
Join Date: Apr 2007
Location: Naples, Italy
Posts: 155
Send a message via Skype™ to giannimaione
Awards Showcase
Beta Tester 
Total Awards: 1
Exclamation missing quotes

Hi mozaharul
i have missing quotes

Quote:
cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = " & txthhidm.Text & " AND motherno = " & ((txthhidm.Text*100) + txtmemno.Text)
here i have correct code:
cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = '" & txthhidm.Text & "' AND motherno = " & ((txthhidm.Text*100) + txtmemno.Text)
__________________
Gianni Maione
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Lite Lock 2220 Questions & Help Needed 4 09-03-2008 10:09 AM
sql lite jchal Questions & Help Needed 1 11-16-2007 12:41 PM
Basic4ppc Lite ? Erel Chit Chat 14 10-18-2007 09:58 PM
How to select a directoty sloopa Questions & Help Needed 7 07-02-2007 04:06 PM
About Select ... case JJM Questions & Help Needed 2 05-22-2007 07:55 AM


All times are GMT. The time now is 03:01 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0