473,803 Members | 3,306 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 6057
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
4368
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
1955
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
4103
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
31207
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
24243
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
2203
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
2811
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
4737
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
9700
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
10546
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
10310
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
10292
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
9121
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7603
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5498
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
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

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.