473,396 Members | 2,011 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,396 software developers and data experts.

System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near

Hi guys,
I'm getting error:-
System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local);database=Northwind;integrated
security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(connString)
objConnection.Open()

Dim sSQL As String = "SELECT Sub_category_id,sub_category_text FROM
Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(connString, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection)

catlist.DataSource = objDataReader
catlist.DataBind()
Nov 18 '05 #1
3 6025
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.SqlClient.SqlException: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local);database=Northwind;integrated
security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(connString)
objConnection.Open()

Dim sSQL As String = "SELECT Sub_category_id,sub_category_text FROM
Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(connString, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection)

catlist.DataSource = objDataReader
catlist.DataBind()

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.ExecuteReader(CommandBehavior.CloseConn ection)

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.SqlClient.SqlException: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local);database=Northwind;integrated
security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(connString)
objConnection.Open()

Dim sSQL As String = "SELECT Sub_category_id,sub_category_text FROM
Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(connString, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection)

catlist.DataSource = objDataReader
catlist.DataBind()

Nov 18 '05 #3
Does anyone have an idea what i'm doing WRONG!!
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.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.ExecuteReader(CommandBehavior.CloseConn ection)

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.SqlClient.SqlException: Line 1: Incorrect syntax near '='.
What could cause this ERRORR
My code below:-
Dim connString As String = "server=(local);database=Northwind;integrated security=true;"
Dim objConnection As SqlConnection
objConnection = New SqlConnection(connString)
objConnection.Open()

Dim sSQL As String = "SELECT Sub_category_id,sub_category_text FROM Sub_Category"

Dim objCommand As SqlCommand
objCommand = New SqlCommand(connString, objConnection)

Dim objDataReader As SqlDataReader
objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection)

catlist.DataSource = objDataReader
catlist.DataBind()

Nov 18 '05 #4

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

Similar topics

2
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,...
2
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 ...
2
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 =...
0
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...
1
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,...
3
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...
2
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...
1
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.