473,484 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

unable to search Text only Integers

ae
I have the following in ASP, and it works fine unless I change the SELECT ID
field to something else that isn't an integer. In other words, if I change
ID to city it doesn't work, and the only connection I can make is that my
bind only accepts integers, can someone help me?

Dim dstProducts As DataSet
Dim dadProducts As SqlDataAdapter
Label1.Visible = False

dstProducts = New DataSet()

Dim conPubs as SqlConnection

conPubs = New
SqlConnection("Server=LENVSQL;uid=itam;pwd=agenda; database=Discovery")

conPubs.Open()

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE ID = " & TextBox1.Text, conPubs)

Try

dadProducts.Fill( dstProducts, "Computer") 'the error occurs here
if ID is changed to City

dgEmployee.DataSource = dstProducts
dgEmployee.DataBind()
dgEmployee.Visible = True

Nov 18 '05 #1
4 1258
String field value should be enclosed with quotes.

Eliyahu

"ae" <ae@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
I have the following in ASP, and it works fine unless I change the SELECT ID field to something else that isn't an integer. In other words, if I change ID to city it doesn't work, and the only connection I can make is that my
bind only accepts integers, can someone help me?

Dim dstProducts As DataSet
Dim dadProducts As SqlDataAdapter
Label1.Visible = False

dstProducts = New DataSet()

Dim conPubs as SqlConnection

conPubs = New
SqlConnection("Server=LENVSQL;uid=itam;pwd=agenda; database=Discovery")

conPubs.Open()

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE ID = " & TextBox1.Text, conPubs)

Try

dadProducts.Fill( dstProducts, "Computer") 'the error occurs here
if ID is changed to City

dgEmployee.DataSource = dstProducts
dgEmployee.DataBind()
dgEmployee.Visible = True

Nov 18 '05 #2
ae
I tried the following, it still does not pick up the values.

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE 'IPAddress'=" & TextBox1.Text, conPubs)

And I have also tried:
dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE 'IPAddress'=" & TextBox1.Text.ToString(),
conPubs)

It still does not pull data, can you give me an example?
"Eliyahu Goldin" wrote:
String field value should be enclosed with quotes.

Eliyahu

"ae" <ae@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
I have the following in ASP, and it works fine unless I change the SELECT

ID
field to something else that isn't an integer. In other words, if I

change
ID to city it doesn't work, and the only connection I can make is that my
bind only accepts integers, can someone help me?

Dim dstProducts As DataSet
Dim dadProducts As SqlDataAdapter
Label1.Visible = False

dstProducts = New DataSet()

Dim conPubs as SqlConnection

conPubs = New
SqlConnection("Server=LENVSQL;uid=itam;pwd=agenda; database=Discovery")

conPubs.Open()

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE ID = " & TextBox1.Text, conPubs)

Try

dadProducts.Fill( dstProducts, "Computer") 'the error occurs here
if ID is changed to City

dgEmployee.DataSource = dstProducts
dgEmployee.DataBind()
dgEmployee.Visible = True


Nov 18 '05 #3
WHERE IPAddress='" & TextBox1.Text & "'", conPubs)

Eliyahu

"ae" <ae@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
I tried the following, it still does not pick up the values.

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE 'IPAddress'=" & TextBox1.Text, conPubs)

And I have also tried:
dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE 'IPAddress'=" & TextBox1.Text.ToString(),
conPubs)

It still does not pull data, can you give me an example?
"Eliyahu Goldin" wrote:
String field value should be enclosed with quotes.

Eliyahu

"ae" <ae@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
I have the following in ASP, and it works fine unless I change the SELECT
ID
field to something else that isn't an integer. In other words, if I

change
ID to city it doesn't work, and the only connection I can make is that

my bind only accepts integers, can someone help me?

Dim dstProducts As DataSet
Dim dadProducts As SqlDataAdapter
Label1.Visible = False

dstProducts = New DataSet()

Dim conPubs as SqlConnection

conPubs = New
SqlConnection("Server=LENVSQL;uid=itam;pwd=agenda; database=Discovery")

conPubs.Open()

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE ID = " & TextBox1.Text, conPubs)

Try

dadProducts.Fill( dstProducts, "Computer") 'the error occurs here if ID is changed to City

dgEmployee.DataSource = dstProducts
dgEmployee.DataBind()
dgEmployee.Visible = True


Nov 18 '05 #4
ae
the following takes care of it.

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE IPAddress =" & "'" & TextBox1.Text & "'",
conPubs)

"ae" wrote:
I tried the following, it still does not pick up the values.

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE 'IPAddress'=" & TextBox1.Text, conPubs)

And I have also tried:
dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE 'IPAddress'=" & TextBox1.Text.ToString(),
conPubs)

It still does not pull data, can you give me an example?
"Eliyahu Goldin" wrote:
String field value should be enclosed with quotes.

Eliyahu

"ae" <ae@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
I have the following in ASP, and it works fine unless I change the SELECT

ID
field to something else that isn't an integer. In other words, if I

change
ID to city it doesn't work, and the only connection I can make is that my
bind only accepts integers, can someone help me?

Dim dstProducts As DataSet
Dim dadProducts As SqlDataAdapter
Label1.Visible = False

dstProducts = New DataSet()

Dim conPubs as SqlConnection

conPubs = New
SqlConnection("Server=LENVSQL;uid=itam;pwd=agenda; database=Discovery")

conPubs.Open()

dadProducts = New SqlDataAdapter( "SELECT ComputerName, IPAddress,
SerialNo FROM Computer WHERE ID = " & TextBox1.Text, conPubs)

Try

dadProducts.Fill( dstProducts, "Computer") 'the error occurs here
if ID is changed to City

dgEmployee.DataSource = dstProducts
dgEmployee.DataBind()
dgEmployee.Visible = True


Nov 18 '05 #5

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

Similar topics

6
1915
by: HartSA | last post by:
Here is the relevent part of my code. I am trying to learn ASP. <body> <table border="0" cellspacing="0" cellpadding="0"> <form name="frmSearch1a" method="get"> <tr> <td align=center>...
1
1237
by: Amit | last post by:
Hi, I am trying to do the following: I have two sets of integers(both are disjoint). Based on some criteria, I choose one integer from each set and do one computationally expensive operation using...
16
4169
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
3
12939
by: Imran Aziz | last post by:
Hello All, I am getting the following error on our production server, and I dont get the same error on the development box. Unable to cast object of type 'System.Byte' to type 'System.String'. ...
2
3130
by: Michael | last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP, I am unable to find out why the "Build for Debug" option within Stored Procedure Builder is not enabled on Java stored...
2
2356
by: Paul Cheetham | last post by:
Hi, I have moved an application from VS2003 to VS2005, and I am now unable to view most of my forms in the designer. The majority of the forms in my project are derived from class PACForm,...
6
3983
by: Amit Bhatia | last post by:
Hi, I am not sure if this belongs to this group. Anyway, my question is as follows: I have a list (STL list) whose elements are pairs of integers (STL pairs, say objects of class T). When I create...
3
2386
by: ashishc | last post by:
Hi All, I have written a AutoSuggest in jsp and am using javascript to call the strut page which calls the database and returns me the xml back. On the html page i have a text box where i enter...
2
2329
by: Andy B | last post by:
I have the following listView control on a page: <asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="PlaceHolder1"> <ItemTemplate> <dl> <dt>
0
7082
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
7105
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,...
1
4845
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...
0
4529
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...
0
3046
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...
0
3041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1359
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 ...
1
592
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
235
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.