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

Discussion in 'ASP .Net' started by =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 11, 2004.

  1. 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.CloseConnection)

    catlist.DataSource = objDataReader
    catlist.DataBind()
     
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 11, 2004
    #1
    1. Advertising

  2. 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.CloseConnection)
    >
    > catlist.DataSource = objDataReader
    > catlist.DataBind()
     
    =?Utf-8?B?cmFuZ2FuaA==?=, Oct 11, 2004
    #2
    1. Advertising

  3. RE: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax n

    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.CloseConnection)

    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.CloseConnection)
    > >
    > > catlist.DataSource = objDataReader
    > > catlist.DataBind()
     
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 11, 2004
    #3
  4. Re: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax n

    Does anyone have an idea what i'm doing WRONG!!


    "Patrick.O.Ige" <> wrote in message
    news:...
    > 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.CloseConnection)
    >
    > 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.CloseConnection)
    > > >
    > > > catlist.DataSource = objDataReader
    > > > catlist.DataBind()
     
    Patrick.O.Ige, Oct 11, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S2FseWFu?=
    Replies:
    2
    Views:
    1,414
    =?Utf-8?B?S2FseWFu?=
    Jun 18, 2004
  2. Kal
    Replies:
    1
    Views:
    9,537
    Kevin Spencer
    Jun 21, 2004
  3. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    System.Data.SqlClient.SqlException: problem!

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Sep 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,447
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=
    Sep 30, 2004
  4. Patrick Olurotimi Ige
    Replies:
    4
    Views:
    7,029
    Patrick Olurotimi Ige
    Mar 18, 2005
  5. egsdar
    Replies:
    0
    Views:
    1,567
    egsdar
    Dec 13, 2008
Loading...

Share This Page