473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Number input translation to SQL

I want to allow my users to enter filter's on a SQL sentence for a numeric
field.

I would like to allow them to write for sample "0-10, 101" which should give
all from 0-10 and 101, in other words allow - for range and , to separate
several numbers.

Is there a built in function to decode this into a number sequence that I
can use in a IN SQL statement?
Or is that something I need to write my self?

The output I would like is from the sample above 0,1,2,3,4,5,6,7,8,9,10,101

- Fredrik
Nov 21 '05 #1
9 1103
Frederik,

This is a newsgroup about dotnet VB language problems, not about problems by
using VBNet.

In my opinion is for your question a SQL language newsgroup the better
choice.

Just my opinion.

Cor
Nov 21 '05 #2
Im talking about VB.NET...

form textbox input, enter 0-10,101 into a textbox...

Question is how to translate that into SQL using VB.net, if there is
something already made for it maybe..

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Frederik,

This is a newsgroup about dotnet VB language problems, not about problems
by using VBNet.

In my opinion is for your question a SQL language newsgroup the better
choice.

Just my opinion.

Cor

Nov 21 '05 #3
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> schrieb:
I want to allow my users to enter filter's on a SQL sentence for a numeric
field.


I suggest to post the question to one of the groups in the
"microsoft.public.sqlserver.*" groups hierarchy.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
Im talking about the input into a VB.NET form...

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ev**************@tk2msftngp13.phx.gbl...
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> schrieb:
I want to allow my users to enter filter's on a SQL sentence for a numeric
field.


I suggest to post the question to one of the groups in the
"microsoft.public.sqlserver.*" groups hierarchy.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb
Frederik,

This is a newsgroup about dotnet VB language problems, not about
problems by using VBNet.
Luckily *I* did not write this :-) because it might be misunderstood. Of
course we handle problems about using VB.Net.
In my opinion is for your question a SQL language newsgroup the
better choice.

Just my opinion.


Sorry, not mine. It's a "how-to" that is probably best placed in a "general
programming" (language unrelated) group but "how-to"s have also always been
handled here.
Armin

Nov 21 '05 #6
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> schrieb
I want to allow my users to enter filter's on a SQL sentence for a
numeric field.

I would like to allow them to write for sample "0-10, 101" which
should give all from 0-10 and 101, in other words allow - for range
and , to separate several numbers.

Is there a built in function to decode this into a number sequence
that I can use in a IN SQL statement?
Or is that something I need to write my self?

The output I would like is from the sample above
0,1,2,3,4,5,6,7,8,9,10,101

No, there is no such function. You have to parse the string on your own.
Maybe regular expressions can handle this but I don't know regexp to be able
to give a specific suggestion. Once I wrote a "ValueAreas" class, that's a
collection of ValueArea objects. Each has a from and to property. You can
add a parse function to analyse the string. Afterwards, you can build an SQL
string from the result. I recommend the "field between .. and ..." syntax
instead of building a comma seperated list - could get pretty long.
Armin

Nov 21 '05 #7
Frederik,

There is nothing build in, however you can use parameters.

How to make logical that string is your problem.

It can be by using Regex or using standard VB.Net with methods as SubString
and Replace.

To see how to use parameters you can look at this page if it is simple
OleDB. Showed are datetimes because that is almost the most complicated to
instert in a SQL string. If you want the sample with SQL server than is for
that an even simpler sample as well on the site.

http://www.windowsformsdatagridhelp....3-eb8b44af0137

I hope this helps,

Cor
..

Nov 21 '05 #8
:-)
Nov 21 '05 #9
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb
:-)


You're feeling fine? :-)
Armin
Nov 21 '05 #10

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

Similar topics

5
by: Matthew Wilson | last post by:
One thing I miss about perl was the builtin $. variable that gets increased after each call to perl's file iterator object. For example: while ( my $line = <IN>) { print "$. $line"; } or,...
66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
2
by: Donald Canton | last post by:
Hi, My goal is to read a text file consisting of lines containing someone's name followed by one or more numeric values. All fields are tab-delimited. The name could be in any one of the...
7
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting...
4
by: B. Fletcher | last post by:
Hi, I'm having some trouble with javascript code of mine: When the script runs, I vget an error in line 119: Number Expected. I'm not sure as to why this is happening. Any advice would be...
8
by: Richard Sherratt | last post by:
It's a database keeping info about people and is expected to contain 20,000 to 25,000 people. I could put a GoToPerson Combo on the form, but the customer and I are not to keen on that. It makes...
2
by: David J Birnbaum | last post by:
Dear Python-list, I need to read a Unicode (utf-8) file that contains text like: I get my input and then process it with something like: When Python encounters the "\f" substring in an input...
19
by: eric.nave | last post by:
this is a slight change to a fequently asked question around here. I have a table which contains a "sortorder" column where a user can specify some arbitrary order for records to be displayed in. ...
2
by: max.giacometti | last post by:
Hi everybody! I am using lex and yacc to write a vhdl to systemc converter. Lex simply reads the input file and yacc implements grammar and translation. I'd like to be able to make yacc...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.