Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 5th, 2004, 07:32 PM
Authorized User
 
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default abt strings manipulation

i have records that contain 10 chars
sample is str000001
dr00000001
ste0000001
how do i know one by one that char is a number or not?

if i enter dr1 it will serach for dr00000001
or ste23 , it will seacrh for ste0000023
hope u understan dit


 
Old October 5th, 2004, 11:15 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

you may need to extract the string portion and numeric portion seperately and add to the string portion the the numeric portion stuffed with the required number of zeroes and then use it for seach in the database

Regards
Ganesh
 
Old October 6th, 2004, 07:08 PM
Authorized User
 
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ganesh,

how can i extrct those string, Im having trouble using the exact syntax in string manipulation using vb.net
tnx
 
Old October 7th, 2004, 06:36 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

There is no exact syntax in VB.NET for string manipulation.To extract portion of the string you need to use substring().
why you need to check each character as char or not?Can you explain it?

 
Old October 7th, 2004, 06:37 AM
Friend of Wrox
 
Join Date: Feb 2004
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code

       Dim str As String
       str = "ste00001"
       Dim strR As String = str.Replace("0", "")

The above code will remove all the "0" in the string str and you can use tht strR string value to search for the record.

The output will be like the strR will contain "ste1"

It is not how much we do,
but how much love we put in the doing.

-Mother Theresa
 
Old October 7th, 2004, 07:27 PM
Authorized User
 
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

tnx pradeep,
ok so we allready remove the 0's
 here's the existing database in sql2000
( Im working on acctng system which has exsiting dtabase and i need to create a new one coded in vb.net, they dont have the source code for the vb6.) i dont need to redesign the databse, heres the design

trno seq bref doc docno
2 1 SGJ GJ SGJ0000001
3 2 SGJ GJ SGJ0000002
4 3 SGJ GJ SGJ0000003
5 4 SGJ GJ SGJ0000004
6 5 SGJ GJ SGJ0000005
7 6 SGJ GJ SGJ0000006

trno is the pri key
notice the field (seq) it’s the same with the numeric format in docno

the existing software CAN search SGJ1 and it will FIND SGJ00000001,

using ur code wer able to remove the zeroes , but I don’t know how to continue it,
tnx very much


 
Old October 8th, 2004, 12:56 AM
Friend of Wrox
 
Join Date: Feb 2004
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey I am seeing the pattern that doc and seq forms the docno, Is that true? Also are you using DataSet? if it is so then I can give you the code like how can you search for the value.

It is not how much we do,
but how much love we put in the doing.

-Mother Theresa
 
Old October 8th, 2004, 03:01 AM
Authorized User
 
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

trno seq bref doc docno
2 1 SGJ GJ SGJ0000001
3 2 SGJ GJ SGJ0000002
4 3 SGJ GJ SGJ0000003
5 4 SGJ GJ SGJ0000004
6 5 SGJ GJ SGJ0000005
7 6 SGJ GJ SGJ0000006

hi pradeep, its seq, and bref combne it and u have docno

 
Old October 8th, 2004, 03:27 AM
Friend of Wrox
 
Join Date: Feb 2004
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok I have a solution for you

Dim dt As DataTable = data.Tables("TableName")
dt.Columns.Add("docnoWithoutZero", GetType(String), _
   "bref + seq")

So it will add one more column to your table as follows

trno seq bref doc docno docnoWithoutZero
2 1 SGJ GJ SGJ0000001 SGJ1
3 2 SGJ GJ SGJ0000002 SGJ2
4 3 SGJ GJ SGJ0000003 SGJ3
5 4 SGJ GJ SGJ0000004 SGJ4

etc., You need not worry about the extrac column here. Now while searching for the particular value, you can do as follows


DataRow[] Rows = data.Tables("TableName").Select("docnoWithoutZero= "+textBox1.Text);

So the above "Select" method will return set of rows with the value you are searching for.

Now you can check whether you have the value like this

if Rows.Count > 0 then
  ' The value is found
endif




It is not how much we do,
but how much love we put in the doing.

-Mother Theresa
 
Old October 10th, 2004, 09:38 PM
Authorized User
 
Join Date: Oct 2004
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

tnx pradeep

again :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
abt help kripa ostwal ASP.NET 1.0 and 1.1 Basics 0 April 6th, 2007 02:13 AM
abt struts satish_macharla Struts 1 August 7th, 2006 11:37 PM
abt combo Box drachx ADO.NET 6 October 11th, 2004 03:32 AM
abt strings drachx BOOK: ASP.NET Website Programming Problem-Design-Solution 1 October 5th, 2004 06:50 AM
Want to know abt BizTalk nagendrakumar_b Biztalk 3 July 29th, 2004 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.