473,804 Members | 4,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wild Character Help

I am trying to use a wild character in the LIKE part of my select statement
for connecting to an AS400 database table and can't get it to work properly.
I can get it to work when I hard code the value in. See below...

strSelectStr = New IBM.Data.DB2.iS eries.iDB2Comma nd("select * from
LIBRARY.CKTIMEF LK5 where TICONO=1 and TIEMPN= 1710 and TIRTIM
LIKE '20070207%'", cn)

However when I try to use a variable that is holding the value I can't get
it to work properly. Below is one of the methods I tried, however it doesn't
match a record and I know that 20070207 is the value of intCardDate.

strSelectStr = New IBM.Data.DB2.iS eries.iDB2Comma nd("select * from
KITDATA.CKTIMEF LK5 where TICONO=1 and TIEMPN= 1710 and TIRTIM LIKE '" &
"'" & intCardDate & "'%'" & "'" & "'", cn)

Can anyone help me out with how I should properly code my LIKE statement.
Thanks in advance.

Mar 13 '07 #1
1 1395
On Mar 13, 11:03 am, Playa <P...@discussio ns.microsoft.co mwrote:
strSelectStr = New IBM.Data.DB2.iS eries.iDB2Comma nd("select * from
KITDATA.CKTIMEF LK5 where TICONO=1 and TIEMPN= 1710 and TIRTIM LIKE '" &
"'" & intCardDate & "'%'" & "'" & "'", cn)

Can anyone help me out with how I should properly code my LIKE statement.
Thanks in advance.
If I'm not mistaken, it looks like you have an extra apostrophe around
the intCardDate value. To make sure you should try setting a variable
and using string.format like so:

dim sQuery as String = String.Format(" Select * From KITDATA.CKTIMEF LK5
Where TICONO=1 and TIEMPN = 1710 and TIRTIM Like '{0}%'",intCard Date)

Then set the Command's CommandText to squery. If that doesn't work
then I'd break in the debugger and copy the value out for sQuery and
try running it manually against the data source to verify your syntax.

Mar 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5386
by: yangyong | last post by:
Simple like this: { int* p1 = new int( 9 ); int* p2 = p1; delete p1; p1 = 0; // how to know p2 now is a wild pointer? }
0
1358
by: Gerry Viator | last post by:
Hi all, I want to remove the test after a period? Why does the wild card * not work? Dim test As String = "This is just a test report. ERCP" MessageBox.Show(Replace(test, ".*", "."))
2
3145
by: Pawe³ | last post by:
Hello! I'm looking for efficient code or site where I can find code for finding one string in another string. String which I search should have "wild" characters like '?' for any one char and '*' for any string of characters. I'm looking for way to effective getting string from text file and then searching it like I write above. Thanks in advance for any helps, notices or sites
2
1844
by: jackie | last post by:
Here is my prolem: i try to output wstring with unicode value greater than 255(for each wchar_t) to a file such as test.tmp. Here is my code: wofstream outdata("test.tmp"); wstring s; long l1=256; long l2=250; wchar_t c1=(wchar_t)l1; wchar_t c2=(wchar_t)l2; s+=l1;
4
2469
by: SatishPasala | last post by:
hi I am tring to remove all the wild characters from a string. Is there any short method to remove them in a single go. I am right now tring to replace one by one. Ex (999) 999-9999 I need 9999999999 with out all the charecters and spaces. I am trying
0
2719
by: fullmetal87 | last post by:
Hi guys, I am having this problem I want to do a search with wild card e.g. ABC will retrieve all the group XYZABC123 or SKDABC or ABC234KD do anyone know the wildcard character to search?? Thanks in advance. For i = 0 To arrList.Count - 1 'Get all members of each group objDirectoryEntry = New DirectoryEntry("WinNT://ABCNT/" & CStr(arrList(i)) & ",group") objIADsMembers =...
9
18054
by: Sreeraj | last post by:
hi, I am a beginner in Python. I wish to know how can i filter a list of strings using wild characters.ie Lets say i have list countries = . I need only the list of string starting with 'a'. thank you
1
1583
by: Gaurav Jhamb | last post by:
I already display all records according to search to put all name of the record. I want to search to put any word in the search field. Acctualy i want to use * before the search word and it display all records where it find out this particular word. Can anyone Help me how to do this. Please reply soon. Thanx in advance
7
9262
by: W. eWatson | last post by:
Is it possible to do a search for a wild card string in another string. For example, I'd like to find "v*.dat" in a string called bingo. v must be matched against only the first character in bingo, and not simply found somewhere in bingo, as might be the case for "*v*.dat". -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.