473,327 Members | 1,952 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,327 software developers and data experts.

Error in code

I am experiencing an error when I run the following code:

Dim dsServer As New DataSet
Dim cmdServer As New SqlCommand
Dim sSelect As String = "SELECT tblServer.DNSName FROM tblServer WHERE
tblServer.IPAddress = " & Integer.Parse(Request.QueryString("ID"))

cmdServer.CommandText = sSelect
cmdServer.Connection = SqlConnection1

Dim daServer As New SqlDataAdapter

daServer.SelectCommand = cmdServer
daServer.Fill(dsServer)

Exception Details: System.Data.SqlClient.SqlException: Syntax error
converting the nvarchar value '10.1.30.130' to a column of data type int.

Source Error:
Line 43: Dim daServer As New SqlDataAdapter
Line 44: daServer.SelectCommand = cmdServer
Line 45: daServer.Fill(dsServer)
Line 46: Dim serverRow As dsServer.tblServerRow
Line 47: txtDNSName.Text = serverRow.DNSName
Source File: c:\inetpub\wwwroot\ITApplications\ServerDetail.asp x.vb Line:
45

Since I am only selecting one field which is a varchar field
(tblServer.DNSName) in my select statement, I am not sure why this is
happening. Any help would be appreciated.

Nov 19 '05 #1
1 1065
JackO,

You are telling your program to convert the passed in string to an integer.
Integers don't have decimal points...

You'll need to use a different data type.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"JackO" <Ja***@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
I am experiencing an error when I run the following code:

Dim dsServer As New DataSet
Dim cmdServer As New SqlCommand
Dim sSelect As String = "SELECT tblServer.DNSName FROM tblServer WHERE
tblServer.IPAddress = " & Integer.Parse(Request.QueryString("ID"))

cmdServer.CommandText = sSelect
cmdServer.Connection = SqlConnection1

Dim daServer As New SqlDataAdapter

daServer.SelectCommand = cmdServer
daServer.Fill(dsServer)

Exception Details: System.Data.SqlClient.SqlException: Syntax error
converting the nvarchar value '10.1.30.130' to a column of data type int.

Source Error:
Line 43: Dim daServer As New SqlDataAdapter
Line 44: daServer.SelectCommand = cmdServer
Line 45: daServer.Fill(dsServer)
Line 46: Dim serverRow As dsServer.tblServerRow
Line 47: txtDNSName.Text = serverRow.DNSName
Source File: c:\inetpub\wwwroot\ITApplications\ServerDetail.asp x.vb
Line:
45

Since I am only selecting one field which is a varchar field
(tblServer.DNSName) in my select statement, I am not sure why this is
happening. Any help would be appreciated.

Nov 19 '05 #2

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

Similar topics

5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
16
by: Steve Jorgensen | last post by:
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before...
6
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
4
by: Eugene Anthony | last post by:
One problem with the code bellow is after this code conn.qDupUser p1,rs I added: set rs = nothing to test the error handling capability.
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.