473,831 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect syntax near

Hi guys,
I'm getting error:-
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local) ;database=North wind;integrated
security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(c onnString)
objConnection.O pen()

Dim sSQL As String = "SELECT Sub_category_id ,sub_category_t ext FROM
Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(conn String, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.Exec uteReader(Comma ndBehavior.Clos eConnection)

catlist.DataSou rce = objDataReader
catlist.DataBin d()
Nov 18 '05 #1
3 6059
Hi,

You need to remove the braces in the connection string for servername
server=(local) needs to be server=local.

Hope it helps.

"Patrick.O. Ige" wrote:
Hi guys,
I'm getting error:-
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local) ;database=North wind;integrated
security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(c onnString)
objConnection.O pen()

Dim sSQL As String = "SELECT Sub_category_id ,sub_category_t ext FROM
Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(conn String, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.Exec uteReader(Comma ndBehavior.Clos eConnection)

catlist.DataSou rce = objDataReader
catlist.DataBin d()

Nov 18 '05 #2
Hi Ranganh and thanks for the email,
I don't think that is the error i tried inputting local but it says
SQL Server does
not exist and i have other aaplications connected to the DB with the same
connection String.

The Error is on line below :-
objDataReader = objCommand.Exec uteReader(Comma ndBehavior.Clos eConnection)

Thats what the Error is saying!!
Any help any ideas!!
"ranganh" wrote:
Hi,

You need to remove the braces in the connection string for servername
server=(local) needs to be server=local.

Hope it helps.

"Patrick.O. Ige" wrote:
Hi guys,
I'm getting error:-
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local) ;database=North wind;integrated
security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(c onnString)
objConnection.O pen()

Dim sSQL As String = "SELECT Sub_category_id ,sub_category_t ext FROM
Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(conn String, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.Exec uteReader(Comma ndBehavior.Clos eConnection)

catlist.DataSou rce = objDataReader
catlist.DataBin d()

Nov 18 '05 #3
Does anyone have an idea what i'm doing WRONG!!
"Patrick.O. Ige" <Pa*********@di scussions.micro soft.com> wrote in message
news:1F******** *************** ***********@mic rosoft.com...
Hi Ranganh and thanks for the email,
I don't think that is the error i tried inputting local but it says SQL Server does
not exist and i have other aaplications connected to the DB with the same
connection String.

The Error is on line below :-
objDataReader = objCommand.Exec uteReader(Comma ndBehavior.Clos eConnection)

Thats what the Error is saying!!
Any help any ideas!!
"ranganh" wrote:
Hi,

You need to remove the braces in the connection string for servername
server=(local) needs to be server=local.

Hope it helps.

"Patrick.O. Ige" wrote:
Hi guys,
I'm getting error:-
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local) ;database=North wind;integrated security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(c onnString)
objConnection.O pen()

Dim sSQL As String = "SELECT Sub_category_id ,sub_category_t ext FROM Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(conn String, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.Exec uteReader(Comma ndBehavior.Clos eConnection)

catlist.DataSou rce = objDataReader
catlist.DataBin d()

Nov 18 '05 #4

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

Similar topics

2
4371
by: Roger R. Smith | last post by:
I see this error in my ASP .NET code: I am trying to execute the following: private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName, User.LastName, User.Status, User.Phone, User.Privs FROM User INNER JOIN Login ON User.UserId = Login.UserId WHERE Login.UserId = @UserId AND Login.Password = @Password";
2
4597
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET Here's the scenario: 1. .NET Windows Client on a remote machine makes a web service call to update tables on a Web Server running SQL Server 2000. 2. The Update is updating about 1000 - 3000 records doing simple update statements like "Update...
2
1958
by: Patrick.O.Ige | last post by:
Can anybody body tell me what my error is here its saying :- System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'. SQLString = "UPDATE treetable SET " & _ "ParentID = '" & ParentID & "', " & _ "FileCategory = '" & Replace(FileCategory, "'", "''") & "', " & _ "NavigateUrl = '" & Replace(NavigateUrl, "'", "''") & "', " & _ "Target = '" & Target & "', " & _ "WHERE FileCategoryID ='" & FileCategoryID & "'"
0
4106
by: Ersin Gençtürk | last post by:
we are getting : System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at...
1
31210
by: Ruth413 | last post by:
Hello - I am getting the these errors in my sql 2005 generated script. I am stuck with first error. Please help.... Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '('. Msg 319, Level 15, State 1, Line 11 Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
3
24247
by: weird0 | last post by:
This is the exception that I get when i create a webserivce obj and call. The error comes on the webmethod call, when it opens a connection to the db. How do I fix it? What is the solution to this? System.Web.Services.Protocols.SoapException: Server was unable to process request. ---System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file g:\inetpub\wwwroot \BankingService\App_Data\BankingDb.mdf failed....
2
2204
by: Carol | last post by:
Exception may be thrown in the code inside the try block. I want to handling the SqlException with State == 1 in a special way, and for all others I want to use a general way to handle. Which of the following options is better? ----------------------------------------------------- Option 1: try{...} catch (System.Data.SqlClient.SqlException ex) { if (ex.State == 1)
1
2814
by: thithi | last post by:
Please help me " System.Data.SqlClient.SqlException: Prepared statement '(@Name varchar(100),@Describes varchar(100),@Money char(10))Upda' expects parameter @Describes, which was not supplied. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Assignment.rose.dtgFlower_UpdateCommand(Object source,...
2
4738
by: lily86 | last post by:
i'm very new so i hope all of u can help me. when i debug my webforms this error occur "An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional information: System error." pls help me solve the problem...thanks.. my code: Imports System.Data.SqlClient Imports System.Data.OleDb Imports System.Globalization Imports System.Threading Public Class PhoneBook
0
9793
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
10777
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10494
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
10534
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,...
0
10208
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4417
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
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.